100x·FDE Roadmap
On this page

Troubleshooting · Block 1 · Week 2 · Building APIs and the backend

When the request fails

Status code says whose fault. The message says what. Read both before you ask.

01The Errors You Should Expect

401Invalid API Key
Part

key

Cause

Key missing, mistyped, a space copied with it, or Bearer missing.

Fix

The header is Authorization: Bearer <key>. Check the environment variable is set in the same terminal that runs the app.

KeyError: 'GROQ_API_KEY'
Part

key

Cause

The variable is not set in this terminal. export vanishes when the terminal closes.

Fix

Set it again before python app.py.

404The model does not exist or you do not have access to it
Part

package, the model field

Cause

A typo, or a retired model. Groq's own quickstart still ships llama-3.3-70b-versatile.

Fix

Use openai/gpt-oss-20b. One word, read straight from the error.

404Not found: wrong address
Part

address

Cause

The domain alone, or a typo in the path. api.groq.com on its own is not an endpoint.

Fix

https://api.groq.com/openai/v1/chat/completions

400Bad request
Part

package

Cause

A missing field or the wrong shape for messages.

Fix

Compare your json= with the package on the practice set.

429Too many requests
Cause

More than 30 requests in a minute on your Groq account.

Fix

Wait a minute. You will not need more.

KeyError: 'choices'
Cause

The request failed, so the reply has error instead of choices.

Fix

Print r.status_code and r.json() first, then find the code above.

ModuleNotFoundError: No module named 'requests'
Fix

pip install requests

NameError: name 'gr' is not defined
Cause

Gradio was never imported.

Fix

Add import gradio as gr at the top.

5xxServer error
Cause

Their machine, not yours.

Fix

Try again later.

02Still Stuck

Write down the status code, the exact message and what you tried, key masked. Writing it out often shows you the fix; if it does not, you now have a precise search query. More: The second interface troubleshooting · Keys.