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.
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/catchand return JSON 500 responses. However, several routes (e.g.,src/app/api/agent-work/route.ts) log errors viaconsole.error()but do not return structured error responses. The groomer API routes (groomer/run/route.ts,groomer/runs/route.ts) all use consistentconsole.error("Failed to ...:", error)+500 JSON. But other routes like/api/reposand/api/automation/repos/trackedmixconsole.logandconsole.errorwithout a standard error-response pattern.Matched top finding
Evidence: Many route handlers wrap their logic in
try/catchand return JSON 500 responses. However, several routes (e.g.,src/app/api/agent-work/route.ts) log errors viaconsole.error()but do not return structured error responses. The groomer API routes (groomer/run/route.ts,groomer/runs/route.ts) all use consistentconsole.error("Failed to ...:", error)+500 JSON. But other routes like/api/reposand/api/automation/repos/trackedmixconsole.logandconsole.errorwithout a standard error-response pattern.