thedotmack/claude-mem · error · Error

GitHub API error

Error message

GitHub API error: ${response.status}

What it means

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.

Solutions

  1. Wait out the GitHub rate-limit window or cache the star count to reduce request volume
  2. Verify the username and repo props match a real, public repository
  3. Retry the request after a delay for transient 5xx responses
  4. Use conditional requests (ETag/If-None-Match) or a server-side proxy with caching to avoid unauthenticated rate limits
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at src/ui/viewer/components/GitHubStarsButton.tsx:28 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of thedotmack/claude-mem@d8bc9755e7 (2026-09-17). Data as JSON: /api/errors/b6f54152ace40952. Report an issue: GitHub.

Appendix: source

Thrown at src/ui/viewer/components/GitHubStarsButton.tsx:28

  if (count < 1000) return count.toString();
  if (count < 1000000) return `${(count / 1000).toFixed(1)}k`;
  return `${(count / 1000000).toFixed(1)}M`;
}

export function GitHubStarsButton({ username, repo, className = '' }: GitHubStarsButtonProps) {
  const [stars, setStars] = useState<number | null>(null);
  const [isLoading, setIsLoading] = useState(true);
  const [error, setError] = useState<Error | null>(null);

  useEffect(() => {
    let cancelled = false;
    (async () => {
      try {
        setIsLoading(true);
        setError(null);
        const response = await fetch(`https://api.github.com/repos/${username}/${repo}`);
        if (!response.ok) {
          throw new Error(`GitHub API error: ${response.status}`);
        }
        const data: { stargazers_count: number } = await response.json();
        if (!cancelled) setStars(data.stargazers_count);
      } catch (err) {
        console.error('Failed to fetch GitHub stars:', err);
        if (!cancelled) setError(err instanceof Error ? err : new Error('Unknown error'));
      } finally {
        if (!cancelled) setIsLoading(false);
      }
    })();
    return () => { cancelled = true; };
  }, [username, repo]);

  const repoUrl = `https://github.com/${username}/${repo}`;

  if (error) {
    return (
      <a

View on GitHub (pinned to d8bc9755e7)