Bug: /v1/digitize silently returns 200 with empty results on corrupt/non-image input #27
Labels
No labels
blocked:needs-attention
blocked:needs-decision
bug
feature-request
in-progress
needs-decompose
quickfix
triage-approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Mark/easystitch-service#27
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?
Summary
POST /v1/digitizereturns 200 OK with{stitchObjects: [], stats: {totalStitches: 0, colorCount: 0, processingMs: N}}when the uploaded image fails to decode, instead of returning a 4xx error. The client has no signal that the image was rejected.Reproduction
The same behavior fires for
Content-Type: text/plainwith arbitrary bytes. Only the empty-file case correctly returns 422 ({"error":"invalid_image","detail":"image_bytes must be non-empty"}).Observed vs expected
{"error":"invalid_image","detail":"image_bytes must be non-empty"}✓{stitchObjects: [], stats: {totalStitches: 0}}✗{stitchObjects: [], stats: {totalStitches: 0}}✗Impact
Suggested fix
In
pipeline_runner.py(or wherever the engine→service boundary decodes the image), catchImageDecodeErrorand re-raise asHTTPException(status_code=422, detail={"error":"invalid_image","detail":<reason>})to match the empty-file error shape. The decode error class already exists per the imports inapp.py.Environment
UI verification follow-up (2026-09-10)
The file upload barrier is now cracked (DataTransfer + Object.defineProperty + dispatchEvent). Confirmed via BrowserOS MCP
snapshotthat ThreadCraft's settings panel unlocks after upload but:act click/act kind=select/ PointerEvent sequence closes the dropdown without updating React state. The next snapshot re-shows the original option as[selected]. Captured React props via__reactPropsconfirmedonClickexists but does not fire under synthetic dispatch.e12or inner-modal Confirm & Edite65) sets Redux state to'digitizing'then'digitized'with a hardcoded "Auto-digitize complete!" message but never firesrunAutoDigitize()→digitize()→ POST to/v1/digitize. BrowserOS MCPhook fetchconfirmed only/healthzGETs during the click sequence. Service log shows zero digitize POSTs across the entire 2026-09-09/10 verification session.This means the UI cannot drive a digitize or export at all in the current ThreadCraft build. The API bugs (#27-31) are still the canonical surface; the UI bugs are symptom-level and tracked separately as #32 (silent no-op), #33 (combobox click swallowed), #34 (false-complete message). Those three will be closed as duplicates of this issue family once the canonical root causes land.
Visual verification (2026-09-09, Gemini-3 Flash via Hermes
vision_analyzetool): Empty workspace screenshots taken via BrowserOS MCP at http://127.0.0.1:5173/workspace confirm the empty-state UI text is consistent — "Drop your image here", "Upload an image to configure stitch parameters", "No design loaded". None of the screenshots reproduce a corrupt-image upload because the browser-driven test path was blocked by hidden file inputs (BrowserOS MCP cannot drive hidden<input type=file>). The API-level reproduction in the original bug body remains the primary evidence. Status: bug confirmed at API layer; UI reproduction blocked by tooling limitation.