SiteError.comYour friendly guide to HTTP status codes
Status CodesBlog
  1. Home
  2. 5xx Server Error
  3. 500 Internal Server Error

500 Internal Server Error

💥
500
Internal Server Error
⚙️
⚙️

Example HTTP Response

HTTP Response
HTTP/1.1 500 Internal Server Error
Content-Type: application/json

{"error": "Something went wrong"}
Common Causes
  • Unhandled exception in code
  • Database connection failed
  • Server misconfiguration
Technical Details

What does this mean?

Oops, we broke it! The server had a little meltdown. It's not you, it's definitely us.

Technical Definition

The server has encountered a situation it doesn't know how to handle.

RFC Says

"The 500 (Internal Server Error) status code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request."

Plain English:

Something unexpected went wrong on the server. This is a catch-all for server errors that don't fit into more specific categories. It's the server saying 'I messed up, but I'm not sure exactly how.'

Common Misinterpretation

Developers often overuse 500 for all server-side errors. If you know the specific problem, use a more specific code: 502 for bad gateway responses, 503 for temporary overload/maintenance, 504 for gateway timeouts. Reserve 500 for truly unexpected errors.

View RFC Documentation
Code Snippets

Ready-to-use code for returning this HTTP status in your application:

Node.js
// Express.js
app.get('/example', (req, res) => {
  res.status(500).json({
    error: 'Internal Server Error',
    message: 'Your error message here'
  });
});

// Native HTTP
const http = require('http');

http.createServer((req, res) => {
  res.writeHead(500, { 'Content-Type': 'application/json' });
  res.end(JSON.stringify({
    error: 'Internal Server Error',
    message: 'Your error message here'
  }));
}).listen(3000);
When to Use This Code
  • Unexpected server error with no more specific 5xx code applicable
  • Unhandled exceptions or crashes in your application
  • Generic catch-all for server-side failures
  • Don't use for known issues - prefer 503 for maintenance, 502 for gateway issues
SEO Handling

Indexing

Temporary 500 errors don't immediately de-index pages. Google retries and only drops pages after persistent failures over days/weeks.

Crawler Behavior

Crawlers back off and retry later when encountering 500 errors. Persistent 500s reduce your crawl budget.

Canonical URL Notes

Fix 500 errors quickly. If they persist, Google may drop the affected pages from the index entirely.

Google Notes

Google gives sites time to recover from 500 errors. Monitor Search Console for server errors and address them promptly.

Google Search Documentation →
From the Blog
  • Understanding 500 Internal Server Error: Causes, Debugging, and Prevention

    A deep dive into HTTP 500 Internal Server Error — what triggers it, how to debug it, and strategies to prevent unhandled server failures in production.

    7 min read
Related Status Codes
🌉502Bad Gateway🔧503Service Unavailable⌛504Gateway Timeout
Commonly Confused With
🌉502Bad Gateway🔧503Service Unavailable

500 Internal Server Error FAQ

What causes a 500 Internal Server Error error?

Unhandled exception in code. Database connection failed. Server misconfiguration.

When should I use 500 Internal Server Error?

Unexpected server error with no more specific 5xx code applicable. Unhandled exceptions or crashes in your application. Generic catch-all for server-side failures. Don't use for known issues - prefer 503 for maintenance, 502 for gateway issues.

451 Unavailable For Legal Reasons501 Not Implemented

Popular Status Codes

  • 200 OK
  • 301 Moved Permanently
  • 302 Found
  • 400 Bad Request
  • 401 Unauthorized
  • 403 Forbidden
  • 404 Not Found
  • 500 Internal Server Error
  • 502 Bad Gateway
  • 503 Service Unavailable

Compare Codes

  • 401 vs 403
  • 301 vs 302
  • 404 vs 410
  • 500 vs 502
  • Compare any codes →

Categories

  • Informational
  • Success
  • Redirection
  • Client Error
  • Server Error
  • NGINX
  • Cloudflare
  • AWS ELB
  • Microsoft IIS

Tools

  • Cheat Sheet
  • Status Code Quiz
  • URL Checker
  • API Playground
  • Blog

© 2026 SiteError.com. All rights reserved.