A 2KB body nested a thousand deep returned 500. The request was
correctly rejected — the traceback ends in RequestValidationError — but
FastAPI then blew the stack building the 422 itself: its default error
puts the offending value in `input`, and jsonable_encoder walks that
value recursively. Every depth from about 990 up failed this way, until
the JSON parser's own limit took over around twenty thousand and
returned a clean 400.
Errors are now reported as type, loc and msg, which is the shape
FastAPI documents in HTTPValidationError and the only part the frontend
reads. Dropping `input` removes the recursion and stops the API
reflecting submitted values back in error bodies.
Verified: depths 100 through 5000 all answer 422, messages and the loc
path including its array index are unchanged, and a sweep of every
write endpoint shows the same status distribution as before.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K6LcH8uUddjJbKrahf34ys