[BUG]: `fetchWithCache` crashes with `SyntaxError: Unexpected end of JSON input` when encountering empty repositories (HTTP 204 No Content)
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- github, javascript
Research direction
Start in src/services/github.js at fetchWithCache and the callers fetchContributors, fetchRepos, fetchIssues, and fetchPulls. Check how the code handles a successful 204 No Content response and whether caller data is iterable; reproduce with an empty repository's contributors endpoint. Done when exploring an organization with empty repositories completes without the reported JSON parsing or iteration errors.
Written by the indexing model from the issue text.
Description
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
- Dominant language
- JavaScript
- Stars
- 53
- Forks
- 187
- Avg merge
- 18m
- Merged PRs (30d)
- 2
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from AOSSIE-Org/OrgExplorer
-
[BUG]: Organization filter dropdown in AnalyticsPage renders empty list due to truthy evaluation of empty issuesDataPossibly taken @havyasreekuppam claimed this 5 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
AOSSIE-Org/OrgExplorer#476 · 5 comments ·
Maintainers usually reply within 1 day
-
Add Pat for 5000 req/hr button not visible when pat expiresPossibly taken @Rajvardhan-Singh-Rathore claimed this 6 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
AOSSIE-Org/OrgExplorer#473 · 6 comments ·
Maintainers usually reply within 1 day
-
[BUG]: PAT popup input lacks label association and visibility button lacks an accessible namePossibly taken @prasanm1423 claimed this 10 days ago. Openbug enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
AOSSIE-Org/OrgExplorer#466 · 2 comments ·
Maintainers usually reply within 1 day
-
[FEATURE]: Set dynamic document.title based on active page routePossibly taken @23241a6749 claimed this 8 days ago. Openenhancement
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
AOSSIE-Org/OrgExplorer#462 · 2 comments ·
Maintainers usually reply within 1 day
-
[BUG]: SocialShareButton logs unconditional console.warn when script is not loadedPossibly taken @vivekrajputofficial29-afk claimed this 8 days ago. Openbug enhancement
Difficulty 1/5 Under an hour Newbie friendliness 89/100
AOSSIE-Org/OrgExplorer#461 · 1 comment ·
Maintainers usually reply within 1 day
All issues in AOSSIE-Org/OrgExplorer
Similar issues
-
marketing
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Kanevry/session-orchestrator#108 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
awesomemotive/all-in-one-seo-pack#3238 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
andromarces/agent-loops#2055 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days