{"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":17183,"sourceCode":"      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\n        .status(403)\n        .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  // Resolving an unused chat is read-only. POST is used only by first send/upload.\n  for (const method of [\"get\", \"post\"] as const) {\n    router[method](\"/companies/:companyId/chats/:agentRef\", async (req, res) => {\n      const companyId = req.params.companyId as string;\n      assertCompanyAccess(req, companyId);\n      if (req.actor.type !== \"board\" || !req.actor.userId) throw forbidden(\"Board user access required\");\n      if (!(await instanceSettings.getExperimental()).enableAgentChat) throw notFound(\"Agent Chat is disabled\");\n      const resolved = await agentsSvc.resolveByReference(companyId, req.params.agentRef as string);\n      if (resolved.ambiguous) throw conflict(\"Agent reference is ambiguous\");\n      if (!resolved.agent) throw notFound(\"Agent not found\");\n      const agent = resolved.agent;\n      const existing = await svc.getConversation(companyId, agent.id, req.actor.userId);","sourceCodeStart":17165,"sourceCodeEnd":17201,"githubUrl":"https://github.com/paperclipai/paperclip/blob/3f1d897a7c018d76563a21c6e39c3c9b03933622/server/src/routes/issues.ts#L17165-L17201","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":"3f1d897a7c018d76563a21c6e39c3c9b03933622","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}