MockFoxAdvertise

HTTP 500 Internal Server Error

Updated Free mock REST & WebSocket APIs

HTTP 500 Internal Server Error — The server hit an unexpected condition that prevented it from fulfilling the request.

Class
5xx Server Error
Defined in
RFC 9110 §15.6.1
Official
Yes (IANA registry)
Cacheable by default
No (unless Cache-Control/Expires say so)
Safe to retry
Sometimes — idempotent requests only

Try it: get a real 500 response

Our test endpoint answers every request with 500 Internal Server Error.

curl -i https://mockfox.dev/api/status/500

Use it in tests, health-check monitors or to see how your client handles a 500. Add ?delay=2000 to slow it down.

What does HTTP 500 mean?

500 Internal Server Error means the server encountered an unexpected condition that prevented it from fulfilling the request. It's the generic catch-all server error: something went wrong on the server, and it can't (or won't) be more specific.

The request itself may be perfectly valid — the problem is server-side, so there's usually little a visitor can do except retry later.

When is 500 used?

  • An unhandled exception in application code (null reference, failed database query).
  • A misconfiguration (bad .htaccess, syntax error in config, missing environment variable).
  • A crashed or missing dependency (database down without proper error handling).

Common causes of a 500

  • A bug triggered by specific input or data.
  • A deploy that broke code or configuration.
  • Missing secrets/env vars in production (DATABASE_URL undefined).
  • PHP fatal errors, exhausted memory limits, wrong file permissions on scripts.
  • WordPress: a faulty plugin or theme, or a corrupted .htaccess.

How to fix 500 Internal Server Error

If you're visiting the site

  1. Reload the page after a minute — many 500s are transient.
  2. Clear the site's cookies (corrupt session data can trigger server errors).
  3. Come back later or contact the site; the owner needs to fix it.

If you run the site or API (developers)

  1. Check the server/application logs first — the stack trace tells you the real error.
  2. Wrap handlers with error middleware that logs details and returns a generic message (never leak stack traces to users).
  3. Roll back the last deploy if 500s started right after it.
  4. Use error monitoring (Sentry, Datadog) and alert on 5xx rate.
  5. Map known errors to precise statuses (404, 409, 422, 503) so 500 means "genuinely unexpected".

Returning or handling 500: server examples

nginx

server {
    error_page 500 502 503 504 /50x.html;
    location = /50x.html { root /usr/share/nginx/html; internal; }
}
# Check: tail -f /var/log/nginx/error.log

Express

// Express 5 forwards rejected promises here automatically
app.use((err, req, res, next) => {
  console.error(err);                       // log the real error
  res.status(err.status ?? 500).json({ error: "internal_error" });
});

Next.js

// app/error.tsx — UI shown when a server or client component throws
"use client";
export default function Error({ error, reset }) {
  return (
    <div>
      <h2>Something went wrong</h2>
      <button onClick={() => reset()}>Try again</button>
    </div>
  );
}

Example 500 response

HTTP/1.1 500 Internal Server Error
Content-Type: application/json
Cache-Control: no-store

{"error":"internal_error","requestId":"req_7f3a9c"}

Related status codes

Related tools

Frequently asked questions

Is a 500 error my fault?

Almost never. It means the server failed. Reloading or clearing the site's cookies sometimes helps, but usually the site owner has to fix it.

How do I find the cause of a 500 error?

Look at the server's error logs or your error-monitoring tool at the time of the request. Locally, run the app in development mode to see the stack trace.

How do I fix 500 Internal Server Error in WordPress?

Rename .htaccess (then re-save permalinks), deactivate plugins by renaming the plugins folder, switch to a default theme, raise the PHP memory limit, and check the PHP error log.

500 vs 502 vs 503?

500: the application itself failed. 502: a proxy got a bad response from the application. 503: the service is deliberately unavailable or overloaded for now.