Group
  • Security

    Stop leaking stack traces and internals in production

    Replaces detailed error output with safe generic messages while keeping full detail in server logs.

    • Improve quality
    • Debug & fix
    • Beginner
    • Replit
    • Cursor
    • Bolt
    • Lovable
    • General

Free Prompt

Make sure my app doesn't leak internal details through error responses in production. Look at global error handlers, API error responses, and any place an exception message or stack trace could reach the client. Implement environment-aware error handling: in production, unhandled errors return a generic message ("Something went wrong") with a correlation ID, while the full stack trace goes to the server log keyed by that ID. In development, keep the detailed output. Check API responses specifically: database error messages, file paths, framework version info, and environment values must never appear in what the client receives. Also check for debug or verbose flags that might be enabled by config and make sure they're off in production builds. Do not swallow errors silently; everything must still be logged server-side with enough detail to debug. Do not change error status codes that clients legitimately depend on (404s, validation 400s with safe messages). Show me each change. Give me a way to verify: an action that triggers a server error, and confirmation that the client sees a generic message with a correlation ID while the full trace appears in the server log.

What This Does / How This Helps

Keeps stack traces, database errors, and file paths out of what users (and attackers) see, while preserving full detail in your server logs. Verbose errors are a free recon report. A stack trace reveals your framework, directory layout, library versions, and sometimes snippets of code or SQL. Attackers use exactly this to plan their next move, and users just see a broken, unprofessional page. The correlation ID pattern is the useful part for you: the user gets a safe message with a reference number, you grep the logs for that number, and you still have everything you need to debug.

Want to skip doing this by hand?

Fortivibe audits your app for all of the areas these prompts cover (and more).

See What We Check

Related Prompts