Mock 500 Internal Server Error Response

Generate a 500 Internal Server Error JSON response. Test your application's error handling, retry logic, and fallback UI for unexpected server failures.

Error Responses

Detailed Explanation

500 Internal Server Error

A 500 status code means something went wrong on the server side. Unlike 4xx errors, the client did nothing wrong. The mock generates a generic error structure without exposing internal details.

Response Structure

{
  "error": {
    "code": "INTERNAL_SERVER_ERROR",
    "message": "An unexpected error occurred. Please try again later.",
    "details": []
  }
}

Security Best Practices

Never expose stack traces, database errors, or internal file paths in production 500 responses. The mock demonstrates the correct pattern:

  • A generic, user-friendly message
  • A machine-readable error code
  • An empty details array (no internal information leaked)

Correlation IDs

In production, you would often include a requestId or correlationId field so that users can reference the specific error when contacting support, and engineers can find the corresponding log entry:

{
  "error": {
    "code": "INTERNAL_SERVER_ERROR",
    "message": "An unexpected error occurred.",
    "requestId": "req_abc123def456"
  }
}

Frontend Handling

When receiving a 500 response:

  1. Display a friendly error message ("Something went wrong")
  2. Offer a retry button
  3. Implement exponential backoff for automatic retries
  4. Log the error for monitoring dashboards
  5. Show the request ID if available, so users can reference it in support tickets

Use Case

QA engineers and frontend developers can use this mock to verify that the application gracefully handles unexpected server errors, displays appropriate fallback UI, and implements retry logic correctly.

Try It — API Response Mocker

Open full tool