FastAPI validation errors (HTTP 422) are hidden from users — readErrorBody ignores body.detail #118
Labels
No labels
blocked:commit-ready-failed
blocked:gate-fetch
blocked:gate-lint
blocked:gate-plan
blocked:gate-research
blocked:needs-attention
blocked:needs-decision
blocked:needs-human
blocked:no-changes
blocked:verify-failed
bug
deferred
feature-request
in-progress
needs-decompose
needs-triage
quickfix
security/medium
triage-approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Mark/Kimi_Agent_Brother_10_Digitizing_App#118
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bug: 422 errors from easystitch-service show "easystitch-service responded 422" with no actionable detail
Reproduction (verified 2026-09-25)
Trigger any 422 from
/v1/digitize. Easiest way: pickdetailstitch preference (see #116) and click Run.Service response body:
Expected
User sees a toast like "Invalid stitch preference: expected one of 'balanced', 'quality', 'speed'".
Actual
User sees: "easystitch-service responded 422".
Root cause
src/lib/easystitch-client.ts:381-407readErrorBody():Looks at
body.errorandbody.message. FastAPI usesbody.detail(singular array of validation errors or a string). Mismatch → fallback.Recommended fix
Change
readErrorBody()to also checkbody.detail:Priority order:
body.message→body.error→body.detail(string or joinedmsgarray) → fallback.Add a unit test for
readErrorBody():{"detail":[{"msg":"Invalid stitchPreference"}]}→ message = "Invalid stitchPreference"{"detail":"some string"}→ message = "some string"{"error":"server error","message":"boom"}→ message = "boom"Severity
Medium. Users hit generic error toasts with no actionable info. Hides #116 entirely (the user just sees "422" without knowing their stitch preference is the cause).
Labels
Filed 2026-09-25 by user-driven bughunt session. Supersedes umbrella #115.
Already shipped in commit
2b2f630(fix(#115): auto-digitize settings wiring — stitch pref translation, underlay wire field, 422 detail surfaced), onorigin/mainof Mark/Kimi_Agent_Brother_10_Digitizing_App. This commit extended the umbrella #115 fix to cover exactly thereadErrorBody()bug filed in #118:pickDetailMessage()extractsbody.detail(string OR FastAPI 422 validation-error array) and the message priority is nowdetail -> message -> error -> fallback, so users see the validation error instead of "easystitch-service responded 422".Tests covering all four cases in
src/lib/easystitch-client.test.ts::describe(readErrorBody):{detail: [...]}(RequestValidationError array) -> message contains stitchPreference / quality{detail: "<long string>"}(HTTPException) -> message contains the detail text{message: "queue is full"}-> falls back to body.message{error: "internal"}only -> falls back to body.erroreasystitch-service responded 502Vitest: 51/51 pass on
src/lib/easystitch-client.test.ts(run 2026-09-29). Closing #118 as effectively a duplicate of #115 -- same commit, same code change.(Closing this card via triage-runner; no further work pending.)