Type: architecture · Difficulty: medium
There is no global error-handler registered after registerRoutes (packages/server/src/index.ts:87). In Express 5 a rejected async handler hits the default handler → an HTML 500 with a stack trace, not the { error } JSON the API uses elsewhere. Most routes (reposRoute, statsRoute, githubIndexRoute, …) have no try/catch around DB/queue calls, so Mongo/Neo4j/Redis being down yields a raw stack.
Do: add one error-handling middleware after registerRoutes that maps known @bb/errors (e.g. MongoNotConnectedError, Neo4jConfigError, RedisConnectError) to 503 with { error, hint }, and unknown errors to 500 { error }. Models to copy: mcpStatsRoute.ts:28, deleteRoute.ts:17.
Done when: infra-down requests return clean JSON with a hint, never an HTML stack.
Type: architecture · Difficulty: medium
There is no global error-handler registered after
registerRoutes(packages/server/src/index.ts:87). In Express 5 a rejected async handler hits the default handler → an HTML 500 with a stack trace, not the{ error }JSON the API uses elsewhere. Most routes (reposRoute,statsRoute,githubIndexRoute, …) have no try/catch around DB/queue calls, so Mongo/Neo4j/Redis being down yields a raw stack.Do: add one error-handling middleware after
registerRoutesthat maps known@bb/errors(e.g.MongoNotConnectedError,Neo4jConfigError,RedisConnectError) to503with{ error, hint }, and unknown errors to500 { error }. Models to copy:mcpStatsRoute.ts:28,deleteRoute.ts:17.Done when: infra-down requests return clean JSON with a hint, never an HTML stack.