{"record":{"id":"b6f54152ace40952","repo":"thedotmack/claude-mem","slug":"github-api-error-response-status","errorCode":null,"errorMessage":"GitHub API error: ${response.status}","messagePattern":"GitHub API error: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/ui/viewer/components/GitHubStarsButton.tsx","lineNumber":28,"sourceCode":"  if (count < 1000) return count.toString();\n  if (count < 1000000) return `${(count / 1000).toFixed(1)}k`;\n  return `${(count / 1000000).toFixed(1)}M`;\n}\n\nexport function GitHubStarsButton({ username, repo, className = '' }: GitHubStarsButtonProps) {\n  const [stars, setStars] = useState<number | null>(null);\n  const [isLoading, setIsLoading] = useState(true);\n  const [error, setError] = useState<Error | null>(null);\n\n  useEffect(() => {\n    let cancelled = false;\n    (async () => {\n      try {\n        setIsLoading(true);\n        setError(null);\n        const response = await fetch(`https://api.github.com/repos/${username}/${repo}`);\n        if (!response.ok) {\n          throw new Error(`GitHub API error: ${response.status}`);\n        }\n        const data: { stargazers_count: number } = await response.json();\n        if (!cancelled) setStars(data.stargazers_count);\n      } catch (err) {\n        console.error('Failed to fetch GitHub stars:', err);\n        if (!cancelled) setError(err instanceof Error ? err : new Error('Unknown error'));\n      } finally {\n        if (!cancelled) setIsLoading(false);\n      }\n    })();\n    return () => { cancelled = true; };\n  }, [username, repo]);\n\n  const repoUrl = `https://github.com/${username}/${repo}`;\n\n  if (error) {\n    return (\n      <a","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d8bc9755e74915e5c3b999181e10a67c889bce2a/src/ui/viewer/components/GitHubStarsButton.tsx#L10-L46","documentation":"GitHubStarsButton fetches stargazers_count from the public GitHub API (api.github.com/repos/{username}/{repo}) on mount. This error is thrown when the HTTP response is not ok — typically 403 (rate limited: unauthenticated GitHub API allows ~60 requests/hour per IP), 404 (wrong username/repo), or 5xx. It is caught in the same effect, logged, stored in state, and causes the component to render a plain GitHub icon link instead of the star count.","triggerScenarios":"Thrown at src/ui/viewer/components/GitHubStarsButton.tsx:28 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Wait out the GitHub rate-limit window or cache the star count to reduce request volume","Verify the username and repo props match a real, public repository","Retry the request after a delay for transient 5xx responses","Use conditional requests (ETag/If-None-Match) or a server-side proxy with caching to avoid unauthenticated rate limits"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d8bc9755e74915e5c3b999181e10a67c889bce2a","analyzedAt":"2026-09-17T16:40:26.182Z","contentChangedAt":"2026-09-17T16:40:26.182Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}