Skip to content

Error handling inconsistency across route handlers #534

Description

@itsmiso-ai

Parent umbrella issue: #495
Source audit: Weekly tech debt audit: dispatch - 2026-07-01
Source audit date: 2026-07-01

Original recommendation

Error handling inconsistency across route handlers

Evidence: Many route handlers wrap their logic in try/catch and return JSON 500 responses. However, several routes (e.g., src/app/api/agent-work/route.ts) log errors via console.error() but do not return structured error responses. The groomer API routes (groomer/run/route.ts, groomer/runs/route.ts) all use consistent console.error("Failed to ...:", error) + 500 JSON. But other routes like /api/repos and /api/automation/repos/tracked mix console.log and console.error without a standard error-response pattern.


Matched top finding

Evidence: Many route handlers wrap their logic in try/catch and return JSON 500 responses. However, several routes (e.g., src/app/api/agent-work/route.ts) log errors via console.error() but do not return structured error responses. The groomer API routes (groomer/run/route.ts, groomer/runs/route.ts) all use consistent console.error("Failed to ...:", error) + 500 JSON. But other routes like /api/repos and /api/automation/repos/tracked mix console.log and console.error without a standard error-response pattern.


Metadata

Metadata

Assignees

No one assigned

    Labels

    auditAudit, review, or investigation work.priority/p2Normal priority.status/backlogNot ready for worker pickup yet.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions