Skip to content
Latchkey

Schemathesis "1 failed" server error in CI

Schemathesis generated inputs from your schema and one made the API return a 5xx, which its server_error check treats as a failure. It prints the failing endpoint and a curl command to reproduce the exact request.

What this error means

The run ends with "1 failed" and a "server_error" section: "Received a response with 5xx status code: 500" plus the method, path, and a reproduction command.

schemathesis
_______________________________ GET /users/{id} ________________________________
1. Test Case ID: ...
- Server error
    [500] Internal Server Error
Reproduce with:
    curl -X GET http://localhost:8000/users/0

Common causes

An input the schema allows crashes the handler

Schemathesis found an edge-case value (boundary, null, unusual string) that the endpoint does not handle, so it returns 500. This is a real bug.

Missing validation lets bad input reach the server

The handler assumes valid input the schema permits but the code does not guard, producing an unhandled exception.

How to fix it

Reproduce and fix the handler

  1. Copy the printed curl command to reproduce the exact request.
  2. Add input validation or fix the code path that raised.
  3. Re-run Schemathesis to confirm the case now passes.

Tighten the schema to match reality

If the input should never be allowed, constrain the schema (formats, min/max, required) so Schemathesis does not generate it.

How to prevent it

  • Validate all input the schema permits before it reaches business logic.
  • Constrain schema types and ranges to match real accepted input.
  • Run Schemathesis in CI to catch unhandled inputs before release.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →