[BUG]: `fetchWithCache` crashes with `SyntaxError: Unexpected end of JSON input` when encountering empty repositories (HTTP 204 No Content)
メンテナーはふだん 4 日以内に返信
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 76/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- github, javascript
調査の方向性
src/services/github.js の fetchWithCache と呼び出し元の fetchContributors、fetchRepos、fetchIssues、fetchPulls から確認します。コードが成功応答 204 No Content をどのように処理するか、また呼び出し元のデータが反復可能かを確認し、空のリポジトリの contributors エンドポイントで再現します。空のリポジトリを含む組織の探索が、報告された JSON の解析エラーや反復エラーなしで完了すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Bug Description
When analyzing a GitHub organization that contains empty repositories (repositories with zero commits or no contributor activity), GitHub's REST API endpoint (GET /repos/{owner}/{repo}/contributors) returns an HTTP 204 No Content status code with an empty response body.
In src/services/github.js, fetchWithCache treats any response where res.ok is true (status 200–299) as JSON and attempts to parse it via await res.json():
// src/services/github.js (Lines 78-82)
if (!res.ok) throw new Error(`HTTP_${res.status}`)
const data = await res.json()
cacheSet(url, data)
return data
Because res.status === 204 has no body, calling res.json() throws an unhandled:
SyntaxError: Unexpected end of JSON input
Furthermore, in caller functions such as fetchContributors, fetchRepos, fetchIssues, and fetchPulls, the return value is spread directly into an array without verifying that data is an array:
// src/services/github.js (Lines 106-108)
const data = await fetchWithCache(url, pat)
all.push(...data)
if (data.length < 100) break
If data is empty, null, or not an array, spreading ...data throws an unhandled:
TypeError: data is not iterable
This causes exploration to fail or drop repositories when analyzing organizations that have placeholder, archived, or newly initialized empty repositories.
Steps to Reproduce
- Open OrgExplorer home page.
- Search for any GitHub organization that contains one or more empty repositories (e.g., an org with newly created repos that have no commits pushed).
- Click EXPLORE (or run complete analysis with a PAT).
- Open browser DevTools Console.
- Notice the uncaught
SyntaxError: Unexpected end of JSON inputwhen fetching contributors for the empty repo.
Logs and Screenshots
GET https://api.github.com/repos/{org}/{empty-repo}/contributors?per_page=100&page=1 204 (No Content)
Uncaught (in promise) SyntaxError: Unexpected end of JSON input
at fetchWithCache (github.js:80)
at async fetchContributors (github.js:106)
at async AppContext.jsx:120
Uncaught (in promise) TypeError: data is not iterable
at fetchContributors (github.js:107)
Environment Details
- OS: Windows 11 / macOS / Linux
- Browser: Google Chrome, Mozilla Firefox, Safari
- Component:
src/services/github.js(fetchWithCache,fetchContributors,fetchRepos,fetchIssues,fetchPulls)
Impact
Critical - Application is unusable
Code of Conduct
- I have joined the Discord server and will post updates there
- I have searched existing issues to avoid duplicates
- 主要言語
- JavaScript
- スター
- 48
- フォーク
- 169
- 平均マージ
- 4日 13時間
- マージ済み PR(30日)
- 25
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
AOSSIE-Org/OrgExplorer のほかの issue
-
[BUG]: Table sort headers can't be used from the keyboard and don't announce sort order対応中かも @Simran-Sobhani が 7 日前に担当しました。 オープンbug enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
AOSSIE-Org/OrgExplorer#419 · コメント 2 件 ·
メンテナーはふだん 4 日以内に返信
-
[BUG]: Connect PAT modal saves invalid GitHub tokens without validation再び着手できるかも @Prince-ES が 9 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
AOSSIE-Org/OrgExplorer#416 · コメント 1 件 ·
メンテナーはふだん 4 日以内に返信
-
[BUG]: Avoid triggering Release Drafter for closed, unmerged pull requests対応中かも @Praveena2809 が 7 日前に担当しました。 オープンbug
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
AOSSIE-Org/OrgExplorer#414 · コメント 2 件 ·
メンテナーはふだん 4 日以内に返信
-
[BUG]: Overview "Language Distribution" percentages are relative to the top-7 languages, not all repos対応中かも @Rohit270406 が 12 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
AOSSIE-Org/OrgExplorer#402 · コメント 1 件 ·
メンテナーはふだん 4 日以内に返信
-
[BUG]: Overview wrongly lists a successfully-loaded org as "could not be loaded" (case / duplicate)対応中かも @Rajvardhan-Singh-Rathore が 7 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
AOSSIE-Org/OrgExplorer#400 · コメント 2 件 ·
メンテナーはふだん 4 日以内に返信
AOSSIE-Org/OrgExplorer の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
area:docs good first issue help wanted priority:medium type:chore
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
mahmutmft/courses-mcp#51 ·
メンテナーはふだん 1 日以内に返信
-
good first issue roadmap ux
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
AhmedNavaz/throughline#100 ·
-
good first issue
難易度 1/5 1〜3時間 初心者へのやさしさ 90/100
samiromer2/Ruby-Consent-Portal#26 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
django-helpdesk/django-helpdesk#1496 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信