{"record":{"id":"c582853139339658","repo":"paperclipai/paperclip","slug":"internal-server-error","errorCode":null,"errorMessage":"Internal server error","messagePattern":"Internal server error","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"server/src/middleware/error-handler.ts","lineNumber":153,"sourceCode":"  if (zodIssues) {\n    res.status(400).json({ error: \"Validation error\", details: zodIssues });\n    return;\n  }\n\n  const rootError = err instanceof Error ? err : new Error(String(err));\n  attachErrorContext(\n    req,\n    res,\n    err instanceof Error\n      ? { message: err.message, stack: err.stack, name: err.name }\n      : { message: String(err), raw: err, stack: rootError.stack, name: rootError.name },\n    rootError,\n  );\n\n  const tc = getTelemetryClient();\n  if (tc) trackErrorHandlerCrash(tc, { errorCode: rootError.name });\n\n  res.status(500).json({\n    error: \"Internal server error\",\n    ...(shouldExposeTrustedCloudTenantImportError(req) ? { message: rootError.message } : {}),\n  });\n}\n\nfunction shouldExposeTrustedCloudTenantImportError(req: Request) {\n  return req.actor?.source === \"cloud_tenant\"\n    && req.method === \"POST\"\n    && req.originalUrl.split(\"?\")[0] === COMPANY_IMPORT_API_PATH;\n}\n","sourceCodeStart":135,"sourceCodeEnd":164,"githubUrl":"https://github.com/paperclipai/paperclip/blob/a7e689b3c35347b529cb9f54c9b9a8575a3dcab6/server/src/middleware/error-handler.ts#L135-L164","documentation":"Terminal branch of the central Express error handler: an unhandled non-Zod error escaped a route handler. The middleware scrubs it to an opaque 500 'Internal server error', attaches error context for diagnostics, and reports the crash code to telemetry before responding.","triggerScenarios":"Thrown at server/src/middleware/error-handler.ts:146 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the server logs for the underlying exception, fix the cause, and retry the request."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a7e689b3c35347b529cb9f54c9b9a8575a3dcab6","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}