Example result: Fix a bug that works locally but fails in production
AI-generated example · Debug · Prod Only
Updated

Fix a bug that works locally but fails in production

When code works on your machine but fails on the live site, the cause is usually a difference between the two setups. This prompt lists those differences, ranks them and tells you how to check the top three.

text-code-works-locally-fails-prod — claude — 96 words

Act as a senior engineer who has debugged many "works on my machine" problems.

What fails in production: [SYMPTOM, e.g. image upload returns 500 on the live site]
Local setup: [e.g. Node 22, SQLite, .env file]
Production setup: [e.g. Node 20 on Vercel, Postgres, env vars in dashboard]
Logs or error: [PASTE]
Code involved: [PASTE]

List the differences between the two environments that could cause this, ranked by likelihood (env vars, versions, file paths, permissions, timezones, build step, caching). For the top three, tell me exactly how to check it and what the fix would be.

The more precisely you describe both environments, the faster it finds the gap. Versions and env vars are the usual suspects.

Get a better result

What you will get

A ranked list of differences between your local and live setups that could explain the failure, with exact checks and fixes for the top three.

Common mistake

The AI guesses without knowing your hosting.

Fix: List versions, the database, how env vars are set and where files are stored in production. Missing details lead to generic answers.

Also watch for
  • The real error is hidden in a general 500 response. Paste the server log from the failing request, not only what the browser shows. Check the timestamp matches your test.
  • A secret value is pasted into the chat. Replace keys, passwords and tokens with placeholders, and send only the names of the variables and whether each is set.
Try a variation: make a parity checklist

Ask for “a short checklist to keep local and production the same, covering versions, env vars and the build step”. Run through it before the next release.

Still not right? Reply with this

Take the most likely cause and give me a single command or log line that proves or rules it out, before I change any code.

Guides that use this prompt

More chat & writing prompts

See all 465 →