Describe the Bug
The three GraphQL methods in backend/app/services/github_service.py (get_activity ~line 46, get_heatmap ~line 107, and get_streak, which calls get_activity) do data = response.json() and then index straight into data["data"]["user"]["contributionsCollection"] with no status or error check. So a "Bad credentials" body (no data key → KeyError), a rate-limit error, or {"data": {"user": null}} for an unknown/renamed user (→ TypeError: NoneType not subscriptable) makes the endpoint 500 with a raw traceback. There's also no raise_for_status() or timeout on those posts. This is a separate path from #61, which is the REST get_language_breakdown.
Where
Steps to Reproduce
- Connect a GitHub account, then revoke/expire the token (or hit a GitHub rate-limit)
- Load the dashboard, which calls
/github/activity, /github/streak, /github/heatmap
- Endpoint returns a 500 instead of a graceful message
Expected Behavior
On a bad/expired token or rate-limit, these should return a clean error (e.g. HTTPException 401/429 with a "reconnect your GitHub" message), not a 500 with a traceback.
Screenshots / Terminal Output
KeyError: 'data' (bad credentials) or TypeError: 'NoneType' object is not subscriptable (when data.data.user is null), raised from github_service.py.
Environment
- OS: any (reproducible cross-platform; observed on Windows 11)
- Browser (if frontend): n/a — backend
- CLI version (if CLI): n/a
- Commit:
f3dd729
Additional Context
Suggested fix: check response.status_code, look for a top-level errors key, and guard data.get("data", {}).get("user") being None; raise a clear HTTPException (surfacing X-RateLimit-Remaining when present). Happy to take it if you assign me.
Contributing as part of Elite Coders Summer of Code (ECSoC 2026).
Describe the Bug
The three GraphQL methods in
backend/app/services/github_service.py(get_activity~line 46,get_heatmap~line 107, andget_streak, which callsget_activity) dodata = response.json()and then index straight intodata["data"]["user"]["contributionsCollection"]with no status or error check. So a "Bad credentials" body (nodatakey →KeyError), a rate-limit error, or{"data": {"user": null}}for an unknown/renamed user (→TypeError: NoneType not subscriptable) makes the endpoint 500 with a raw traceback. There's also noraise_for_status()or timeout on those posts. This is a separate path from #61, which is the RESTget_language_breakdown.Where
clutch-cli)Steps to Reproduce
/github/activity,/github/streak,/github/heatmapExpected Behavior
On a bad/expired token or rate-limit, these should return a clean error (e.g. HTTPException 401/429 with a "reconnect your GitHub" message), not a 500 with a traceback.
Screenshots / Terminal Output
KeyError: 'data'(bad credentials) orTypeError: 'NoneType' object is not subscriptable(whendata.data.userisnull), raised fromgithub_service.py.Environment
f3dd729Additional Context
Suggested fix: check
response.status_code, look for a top-levelerrorskey, and guarddata.get("data", {}).get("user")beingNone; raise a clearHTTPException(surfacingX-RateLimit-Remainingwhen present). Happy to take it if you assign me.Contributing as part of Elite Coders Summer of Code (ECSoC 2026).