{"record":{"id":"9fbbb5171267624e","repo":"paperclipai/paperclip","slug":"issue-does-not-belong-to-company","errorCode":null,"errorMessage":"Issue does not belong to company","messagePattern":"Issue does not belong to company","errorType":"http","errorClass":null,"httpStatus":422,"severity":"error","filePath":"server/src/routes/issues.ts","lineNumber":13652,"sourceCode":"      return;\n    }\n    const includePayload = parseBooleanQuery(req.query.includePayload) || req.query.includePayload === undefined;\n    const trace = await feedback.getFeedbackTraceById(traceId, includePayload);\n    if (!trace || !actorCanAccessCompany(req, trace.companyId)) {\n      res.status(404).json({ error: \"Feedback trace not found\" });\n      return;\n    }\n    res.json(trace);\n  });\n\n  router.get(\"/feedback-traces/:traceId/bundle\", async (req, res) => {\n    const traceId = req.params.traceId as string;\n    if (req.actor.type !== \"board\") {\n      res.status(403).json({ error: \"Only board users can view feedback trace bundles\" });\n      return;\n    }\n    const bundle = await feedback.getFeedbackTraceBundle(traceId);\n    if (!bundle || !actorCanAccessCompany(req, bundle.companyId)) {\n      res.status(404).json({ error: \"Feedback trace not found\" });\n      return;\n    }\n    res.json(bundle);\n  });\n\n  router.post(\"/issues/:id/comments\", validate(addIssueCommentSchema), async (req, res) => {\n    const id = req.params.id as string;\n    const issue = await getAccessibleResource(req, res, svc.getById(id), \"Issue not found\");\n    if (!issue) return;\n    if (req.actor.type === \"agent\" && req.body.onBehalfOfUserId != null) {\n      await auditAgentIssueCommentAttributionSpoof({\n        db,\n        req,\n        issue,\n        surface: \"issue.comment.create\",\n        requestedValue: readNonEmptyString(req.body.onBehalfOfUserId),\n      });","sourceCodeStart":13634,"sourceCodeEnd":13670,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/server/src/routes/issues.ts#L13634-L13670","documentation":"422 from POST /companies/:companyId/issues/:issueId/attachments. Fires after the issue is resolved but its companyId differs from the companyId path parameter — the attachment endpoint requires the issue to actually belong to the named company.","triggerScenarios":"Thrown at server/src/routes/issues.ts:12633 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Correct the request so it satisfies the condition stated in the error message, then retry; see the throwing line in the named file for the exact check."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}