Why Your GitHub Stats Card Keeps Breaking
You are seeing a box where your GitHub stats card should be. You did not break anything. The shared stats infrastructure is just overloaded. Here is how to fix it for good.
I have been there. You finish tweaking your GitHub profile README everything looks perfect. You head to bed feeling like a markdown wizard. You wake up the morning pull up your GitHub profile to admire your work and boom. That beautiful GitHub stats card is a broken gray box or a tiny red "Error" icon.
You start doubting yourself. Did I mess up the image tag? Did I delete a bracket? Let me save you 20 minutes of troubleshooting: you did not break anything. Nobody did. When thousands of developers point their GitHub READMEs at the same free API endpoint things inevitably crash.
This is one of those little problems nobody warns you about when they tell you to just drop an image URL into your GitHub profile. It works flawlessly on day one. Then at some point it stops rendering entirely and you are left looking like a developer who does not know how to format an image tag.
Why Your GitHub Readme Stats Generator Is Failing
If you want a scannable GitHub UI the answer is usually fewer flashy widgets and more readable code. If you do want that GitHub stats card you need to understand how it actually works.
Tools like github-readme-stats do not generate a PNG once and cache it forever. Every single time a recruiter or peer opens your GitHub profile that image tag triggers a network request. It hits a service, which then queries GitHubs API for your live commit data builds an SVG on the fly and serves it back.
That real-time rendering is what makes the GitHub stats feel so dynamic. It is also why the whole system falls apart under pressure.
GitHub imposes rate limits on API requests to prevent abuse. When you use the default instance of a github readme stats generator you are sharing that API quota with tens of thousands of other GitHub profiles. When traffic spikes the shared quota hits its limit. Github shuts the door. That is why the GitHub stats card fails for everyone at once.
Fix GitHub Stats Card API Limit Issues With a Self-Hosted Instance
I know what you are thinking. "Self-hosting" sounds intimidating. It sounds like spinning up AWS EC2 instances, managing proxies and babysitting a Linux box. For this specific use case it is actually trivial. You are just deploying a copy of the open-source stats tool under your own GitHub account. This lets your GitHub profile use your personal API quota instead of the congested shared one.
Honestly it is the real way to permanently fix GitHub stats card API limit headaches so you can stop waking up to broken images.
- Fork the GitHub repository. Head over to the popular
anuraghazra/github-readme-statsrepo. Fork it to your own GitHub account. - Create a Personal Access Token (PAT). Go to your GitHub developer settings. Generate a token with read-only access to your public data (no crazy admin permissions needed). Save this token. You will need it in a second.
- Deploy your fork to Vercel. Log into Vercel click "Add New Project" and select your forked GitHub repo. In the environment variables section add your PAT (usually named
PAT_1). Hit deploy. - Update your GitHub README. Swap the domain in your image URL from the shared domain to your shiny new Vercel domain.
The whole process takes maybe 15 minutes and I promise you will never look back. Your GitHub stats card just works because it is no longer fighting the rest of the internet for a handful of API requests.
Check If Your PAT Is Expired
So you self-hosted and everything was great for 30 days. Then suddenly the gray box of doom returns. What happened?
I made this mistake myself. GitHub now defaults to 30-day expirations on Personal Access Tokens for security reasons. If your self-hosted instance randomly dies a month after you set it up your PAT probably expired.
To check this jump into your GitHub Developer Settings click on "Personal access tokens". Look for the one you created for Vercel. If it says "Expired" you need to generate a new one copy it and paste it into your Vercel projects environment variables. Remember to trigger a deployment in Vercel so it picks up the new key. If you hate doing this you can set the token to never expire. Just be careful not to accidentally leak it in a public GitHub repo.
Decoding Specific Error Messages
Sometimes the GitHub stats card does not just show an image icon; it actually renders an SVG containing a text error. Here is what those mean:
- "Maximum retries exceeded": This is the rate limit error. It means the server tried to hit GitHubs API got blocked, waited, tried again and gave up. If you see this on a self-hosted instance you might genuinely be getting much traffic (congratulations!) but it usually only happens on the shared public endpoints.
- "Bad Credentials": This always means your PAT is expired revoked or you pasted it incorrectly into Vercel. Go generate a new one.
- "User not found": You probably made a typo in the
?username=parameter of your image link. Double-check your spelling.
Setting Up Automatic Vercel Redeployment
Here is a tip to keep things running smoothly. When the creator of the stats tool merges a bug fix or adds a cool new theme to the main GitHub repo your fork does not get those updates automatically. Your Vercel app is stuck in time on the day you forked it.
To fix this you should set up syncing. GitHub has a "Sync fork" button right on your repository page. If you click that it pulls the code from the upstream GitHub repo into yours.
Because Vercel is connected directly to your GitHub repository the moment you click "Sync fork" Vercel notices the commit and automatically rebuilds and redeploys your GitHub stats card API. Zero extra work required. You can even set up a GitHub Action to run a cron job that automatically syncs your fork every week so you literally never have to think about it again.
Your Quick Troubleshooting Checklist
Next time your GitHub streak stats widget or standard GitHub stats card goes down do not panic. Run through this list:
- Did my GitHub Personal Access Token expire?
- Did I accidentally change my GitHub username without updating the URL in my README?
- Is Vercel experiencing an outage? (Check their status page).
- Did I misconfigure the environment variables in my Vercel dashboard?
- Am I using the shared instance instead of my self-hosted URL?
Wakatime and Alternative Trackers
If you genuinely do not want to mess with deploying anything to Vercel, the lowest-effort move is choosing a stats tool with a smaller user base. The popular tool breaks the most often simply because it is popular.
Using a GitHub readme stats integration or a niche GitHub profile views counter can buy you stability without touching a line of deployment code. Smaller tools hit rate limits less frequently. It is not a bulletproof fix. It is a solid middle ground.
Ultimately a broken GitHub stats card on your profile is not a reflection of your coding skills. It sure does not look great when a recruiter clicks your link. Taking 15 minutes to self-host removes the risk completely. It is a nice little excuse to play around with Vercel and GitHub APIs if you have not already.
Need a starting template?
Browse 9 professional developer-tested templates in our gallery.