Application code
- Typical cause
- Unhandled exception, bad input the code did not expect, failed dependency
- Who can fix it
- Developer
HTTP 500 means the server hit an unexpected condition and could not finish the request. See the causes, what visitors can try, and how owners trace and fix it.
HTTP 500 Internal Server Error means the server encountered an unexpected condition that prevented it from fulfilling the request. It is a generic catch-all for server-side failures, so the fix is usually with the site owner or host. Visitors can retry later; owners should read the error log for the failing request and fix the code or configuration it points to.
Four quick questions, then a straight answer.
From your answers, this is quietly costing you traffic and nobody has the hours to chase it. Scaplet finds every affected page, drafts the fixes and tracks how AI answers mention you.
A data platform shipped 46 fixes without a ticket.
This looks handled. Re-check after a redesign, a migration or a big content push; that is when it breaks.
Your site is small and you have the time. Work through the steps on this page, starting with the pages that get the most traffic.
MDN lists improper server configuration, out-of-memory issues, unhandled exceptions and improper file permissions among the many possible causes. A visitor cannot fix any of them. Cloudflare says a 500 from a site behind it indicates a problem with your origin web server, and calls "Error establishing database connection" a common 500 message.
A reload costs nothing and rules out a one-off failure.
MDN says 500s require investigation by server owners or administrators. There is nothing to fix on your side if other sites load normally.
Send the URL and the time. The site owner needs both to find the matching log entry.
The server may have completed part of the work before failing. Check for a confirmation email or account entry first.
Note the URL, method, time and request ID if you have one. A curl -i against the URL shows the status and headers.
Look in the application log and the web server error log for that time. A stack trace or a specific error message usually names the file or dependency.
Compare against the last deploy, configuration change, dependency update or traffic spike. Roll back if the timing matches.
Look at memory, disk, database connections and any third-party API the request calls.
Confirm the status changes to the one you intend, and watch the logs for new entries.
import http from "node:http";
const server = http.createServer(async (req, res) => {
try {
await handle(req, res); // your application code
} catch (err) {
console.error(req.method, req.url, err); // detail goes to logs
res.writeHead(500, { "Content-Type": "text/plain" });
res.end("Something went wrong on our side.");
}
});A 500 that appears only when a proxy is in front may really be a gateway problem; compare 502 Bad Gateway and 503 Service Unavailable. Use 503, not 500, for planned maintenance, because it signals that the condition is temporary.
4 questions people ask next, answered from the sources on this page.
The server hit an unexpected condition and could not complete the request. It is a general server-side failure, not a problem with your browser or connection, and the cause is not stated in the response.
A 500 is a generic failure from an unexpected condition. A 503 says the server is currently unable to handle the request because of a temporary overload or scheduled maintenance, and may include a Retry-After header. See 503 Service Unavailable.
No. MDN says 500 errors require investigation by server owners or administrators. You can reload or come back later, and report the URL and time to the site.
Reproduce one failing request, find its entry in the application and web server logs, and compare the time with your last deploy or configuration change. The stack trace or error message normally points to the cause.
Run the free audit, then approve the fixes. Every change can be undone.