{"record":{"id":"4fe6bf2b9bd785c8","repo":"paperclipai/paperclip","slug":"validation-error","errorCode":null,"errorMessage":"Validation error","messagePattern":"Validation error","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"server/src/middleware/error-handler.ts","lineNumber":136,"sourceCode":"      ...(workspaceRepairPreconditionFailure && typeof details?.repairPhase === \"string\"\n        ? { repairPhase: details.repairPhase }\n        : {}),\n      ...(typeof details?.remediation === \"string\" || (structuredConnectionError && details?.remediation && typeof details.remediation === \"object\")\n        ? { remediation: details.remediation }\n        : {}),\n      ...(structuredConnectionError && details?.connection ? { connection: details.connection } : {}),\n      ...(structuredConnectionError && details?.subject ? { subject: details.subject } : {}),\n      ...(structuredConnectionError && typeof details?.grantId === \"string\" ? { grantId: details.grantId } : {}),\n      ...(!redactedSkillPolicyDenial && !workspaceRepairPreconditionFailure && err.details\n        ? { details: err.details }\n        : {}),\n    });\n    return;\n  }\n\n  const zodIssues = readZodIssues(err);\n  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\",","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/paperclipai/paperclip/blob/a7e689b3c35347b529cb9f54c9b9a8575a3dcab6/server/src/middleware/error-handler.ts#L118-L154","documentation":"Zod branch of the central Express error handler: a request handler threw a ZodError (parsed request body/query failed its schema), so the middleware converts the issues into a 400 'Validation error' response with the flattened issue list instead of a 500.","triggerScenarios":"Thrown at server/src/middleware/error-handler.ts:129 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the request payload according to the validation error details and retry."],"exampleFix":null,"handlingStrategy":"validation","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-14T00:17:10.932Z"}