// http 5xx · server error
HTTP 500 Internal Server Error
A generic server-side failure.
What HTTP 500 Internal Server Error means
500 Internal Server Error is the generic server-side failure — something went wrong on the server and it couldn't be more specific. It always points at the server or application code, never the client's request format.
Which category is it?
500 is a 5xx code — Server error. 5xx means the server failed to fulfil an apparently valid request. It's the server's responsibility, not the caller's.
Common causes
- An unhandled exception in application code
- A misconfiguration or failing dependency
- A database or downstream call that threw
How to fix it
- Check the server logs for the actual stack trace
- Reproduce locally and fix the failing code path
- Add error handling so failures return a clearer code
Example 500 response
HTTP/1.1 500 Internal Server Error
Content-Type: application/json
{"error":"Internal Server Error"}How to diagnose a 500
- Open the server or application error log at the time of the request. A 500 almost always leaves a stack trace or error message there.
- Reproduce the request with the same method, path, headers and body (curl or an API client) to see if it fails every time.
- Check recent changes: a deploy, a configuration or environment variable change, a database migration, or an expired credential for a dependency.
- For PHP and similar stacks, check file permissions and syntax errors in configuration such as .htaccess.
500 compared with similar codes
- 502: 502 means a gateway got a bad response from the upstream. 500 means the application itself failed.
- 503: 503 is a deliberate unavailable response and may carry Retry-After. 500 is an unexpected failure.
- 400: A 400 blames the request. A 500 blames the server, so the same request may succeed after a fix.
500 Internal Server Error: common questions
How do I fix a 500 Internal Server Error as a site visitor?
Reload the page after a minute and try again later. The problem is on the server, so there is little you can fix. If it persists, contact the site owner.
How do I fix it as a developer?
Find the error in the logs, reproduce it, and fix the failing code or configuration. Return a more specific status (400, 404, 409, 422) where the cause is the request rather than the server.
Other server error (5xx) codes
500 Internal Server Error 501 Not Implemented 502 Bad Gateway 503 Service Unavailable 504 Gateway Timeout 505 HTTP Version Not Supported