Groq API Error Codes Explained: 400, 401, 429, 5xx and Fixes
Every status code the Groq API returns, what actually causes it, whether it is safe to retry, and how to tell a bug in your request from an outage on Groq's side.
📡 Monitor your APIs — know when they go down before your users do
Better Stack checks uptime every 30 seconds with instant Slack, email & SMS alerts. Free tier available.
Affiliate link — we may earn a commission at no extra cost to you
Groq speaks the OpenAI error envelope, which is convenient right up to the moment it isn't: the same error.type strings carry Groq-specific meanings, and Groq ships a couple of status codes the OpenAI SDK has never heard of.
The single most expensive mistake in Groq integrations is treating every non-200 the same way: one generic catch block, one blind retry loop. Half of Groq's error codes are deterministic — retrying them cannot succeed, it only burns quota and hides the real cause. This guide splits them into the ones you fix, the ones you wait out, and the ones you fail over on.
Quick triage: 4xx is your request or your account. 5xx is Groq. If you are seeing 5xx across more than one API key, check live Groq status before you change a line of code.
Every Groq API Error Code
Codes below are what Groq returns in production today. Response shapes drift as APIs version, so log the full body — the message text usually names the failing field, and that detail is what turns a 20-minute debug into a 20-second one.
| Code | Type | What causes it | Fix |
|---|---|---|---|
400 | invalid_request_error | Malformed JSON body, unknown parameter, or a messages array that violates role ordering. | Log the full response body — Groq names the offending field. Strip OpenAI-only params (e.g. unsupported penalties) before sending. |
401 | invalid_api_key | Missing, revoked, or wrong-project key. Also fires when the Bearer prefix is dropped. | Re-issue the key in the Groq Console and confirm the header is Authorization: Bearer $GROQ_API_KEY. Never retry a 401. |
404 | model_not_found | The model string does not exist, or it was decommissioned. Groq's most common non-quota error. | Pull the live list from GET /openai/v1/models and update your pinned name. Do not retry. |
413 | request_too_large | Payload exceeds the per-request ceiling, usually an unbounded chat history or a pasted document. | Truncate context, summarize older turns, or chunk the input. Retrying identical bytes always fails. |
422 | json_validate_failed | JSON mode or tool calling produced output that failed schema validation. | Simplify the schema, lower temperature, and retry once — this one is genuinely transient. |
429 | rate_limit_exceeded | Your RPM, RPD, TPM or TPD ceiling is exhausted. Not an outage. | Back off with jitter, honor retry-after, and fall over to a sibling model — Groq meters per model. |
498 | flex_tier_capacity_exceeded | Flex/on-demand tier had no spare capacity for your request at that instant. | Retry after a short pause or resubmit on the standard tier. Bursty batch jobs see this most. |
499 | request_cancelled | The client hung up — usually your own timeout or a closed serverless connection, not Groq. | Raise the client timeout above the model's realistic latency and avoid aborting streams early. |
500 | internal_server_error | Groq-side fault. Affects everyone hitting the same capacity. | Retry twice with backoff, then fail over. Check the status page before touching code. |
503 | service_unavailable | Capacity is saturated or a deploy is rolling. Transient but real on Groq's side. | Fail over to your backup provider immediately; retries against a saturated pool rarely help. |
Catch Error-Rate Spikes Before Support Tickets Do
Track status-code distribution and latency on your Groq endpoint continuously, so a shift from 200s to 429s or 503s shows up on a dashboard instead of in a customer email.
Try Better Stack Free →The Groq Error That Wastes the Most Time
Groq's signature failure is a 404 model_not_found on a model that worked last month. Groq retires hosted models faster than any other major inference provider, so a deployment that has not been touched in a quarter can break with nothing wrong on your side and nothing wrong on Groq's. Pin model names in config, not in code, and treat a sudden 404 as a deprecation notice you missed rather than an outage.
Retry or Don't: The Decision Table
This is the part most error handling gets wrong. Retrying a deterministic error is strictly worse than failing fast — it delays the real signal and, on paid tiers, multiplies the bill.
| Behaviour | Codes | What to do |
|---|---|---|
| Never retry | 400, 401, 404, 413, 498, 499 | Deterministic. Fix the request, the key, the model name, or the account state. Surface the error immediately. |
| Retry with backoff | 422, 429 | Transient. Exponential backoff with jitter, honor retry-after, cap at four or five attempts. |
| Fail over | 500, 503 | Groq-side. Route to your backup provider on the second consecutive failure rather than queueing requests behind an outage. |
Error Handling That Distinguishes All Three
One handler, three behaviours. The important line is the one that does not retry.
const FATAL = new Set([400, 401, 404, 413, 498, 499]);
async function callGroq(body, attempt = 0) {
const res = await fetch('https://api.groq.com/openai/v1/chat/completions', {
method: 'POST',
headers: { 'Authorization': `Bearer ${process.env.GROQ_API_KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify(body),
});
if (res.ok) return res.json();
// Log the body once — it names the failing field on every 4xx
const detail = await res.text();
if (FATAL.has(res.status)) {
throw new Error(`Groq error ${res.status} (not retryable): ${detail}`);
}
if (res.status >= 500) {
// Groq-side: fail over rather than queue behind an outage
if (attempt >= 1) return callFallbackProvider(body);
}
if (attempt >= 4) throw new Error(`Groq failed after retries: ${detail}`);
const retryAfter = Number(res.headers.get('retry-after')) || 0;
const backoff = retryAfter * 1000 || (2 ** attempt) * 500 + Math.random() * 500;
await new Promise((r) => setTimeout(r, backoff));
return callGroq(body, attempt + 1);
}Note the fallback triggers on the second 5xx, not the first. A single 500 is often a one-off on a single host; two in a row is an incident, and that is the point where switching providers beats waiting.
Keep Provider Keys Rotatable
Testing a second key is the fastest way to prove a 401 or 429 is yours rather than theirs. Store and rotate provider credentials properly instead of pasting them into env files.
Try 1Password Free →Your Error or Theirs? A 60-Second Check
- Read the status class. 4xx is you, 5xx is Groq. Nothing else in this list matters if you skip this step.
- Log the response body. Groq names the offending field or model in the message — the status code alone is rarely enough.
- Try a second API key. If a different key on a different account works, the problem is your account state or quota.
- Try a different model. A working sibling model rules out an infrastructure-wide incident and points at naming, context length, or per-model capacity.
- Check groqstatus.com and live Groq monitoring for a confirmed incident before rolling back your own deploy.
For the outage-side playbook, see our Is Groq Down? guide. For quota specifically, the Groq rate limit guide covers headers and tier ceilings in depth.
Where to Send Traffic When Groq Returns 5xx
Fallbacks only help if they are configured before the incident. Each of these runs on independent infrastructure and an independent quota pool, so a Groq 503 does not follow you there.
Together AI
Independent infrastructure and quota pool. Route overflow here when Groq returns 5xx.
Check Together AI status →Mistral
Independent infrastructure and quota pool. Route overflow here when Groq returns 5xx.
Check Mistral status →OpenAI
Independent infrastructure and quota pool. Route overflow here when Groq returns 5xx.
Check OpenAI status →Frequently Asked Questions
What do Groq API error codes mean?
Groq returns the OpenAI-style error envelope with a status code and an error.type string. 400 means a malformed request, 401 a bad key, 404 a missing or decommissioned model, 413 an oversized payload, 422 a JSON/tool-schema validation failure, 429 an exhausted rate limit, 498 flex-tier capacity exhaustion, 499 a client-side cancellation, and 5xx a genuine Groq-side fault. Only 422, 429, 498 and 5xx are worth retrying.
Why am I getting model_not_found from Groq when the model used to work?
Groq decommissions hosted models faster than most inference providers, so a pinned model name can stop resolving with no change on your side. Call GET /openai/v1/models to list what is currently served and update your configuration. A 404 is never transient — retrying it will fail forever.
Is a Groq 429 an outage?
No. A 429 is Groq enforcing your own quota and it affects only your API key, while an outage returns 500 or 503 to everyone. Groq also meters per model, so if a smaller sibling model still answers, you are rate limited rather than looking at an incident.
How should I retry Groq errors?
Retry only 422, 429, 498 and 5xx. Use exponential backoff with jitter, honor the retry-after header when Groq sends it, and cap attempts at four or five. Never retry 400, 401, 404 or 413 — those are deterministic and will return the same error every time while burning your quota.
What does a 499 from Groq mean?
A 499 means the connection was closed before Groq finished responding, and in practice the culprit is almost always on your side: a serverless function timeout, an aggressive client timeout, or an aborted stream. Raise your timeout above the model's realistic p99 latency before you suspect Groq.
Related Groq Guides
Stop Guessing Which Side the Error Is On
API Status Check monitors Groq and every other provider in your stack, so a bad deploy and a provider incident never look the same again.
Start Your Free Trial →Alert Pro
14-day free trialStop checking — get alerted instantly
Next time Groq goes down, you'll know in under 60 seconds — not when your users start complaining.
- Email alerts for Groq + 9 more APIs
- $0 due today for trial
- Cancel anytime — $9/mo after trial
🌐 Can't Access Groq?
If Groq is working for others but not for you, it might be an ISP or regional issue. A VPN can help bypass network-level blocks and routing problems.
Troubleshoot with a VPN
Connect from a different region to test if the issue is local to your network. Also protects your connection on public Wi-Fi.
Try NordVPN — 30-Day Money-Back GuaranteeSecure Your Groq Account
Service outages are a common time for phishing attacks. Use a password manager to keep unique, strong passwords for every account.
Try NordPass — Free Password Manager⏳ While You Wait — Try These Alternatives
🛠 Tools We Use & Recommend
Tested across our own infrastructure monitoring 200+ APIs daily
SEO & Site Performance Monitoring
Used by 10M+ marketers
Track your site health, uptime, search rankings, and competitor movements from one dashboard.
“We use SEMrush to track how our API status pages rank and catch site health issues early.”