paperclipai/paperclip · error

Issue does not belong to company

Error message

Issue does not belong to company

What it means

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.

Solutions

  1. 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.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server/src/routes/issues.ts:12633 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of paperclipai/paperclip@3f1d897a7c (2026-08-18). Data as JSON: /api/errors/9fbbb5171267624e. Report an issue: GitHub.

Appendix: source

Thrown at server/src/routes/issues.ts:17183

      req.query.includePayload === undefined;
    const trace = await feedback.getFeedbackTraceById(traceId, includePayload);
    if (!trace || !actorCanAccessCompany(req, trace.companyId)) {
      res.status(404).json({ error: "Feedback trace not found" });
      return;
    }
    res.json(trace);
  });

  router.get("/feedback-traces/:traceId/bundle", async (req, res) => {
    const traceId = req.params.traceId as string;
    if (req.actor.type !== "board") {
      res
        .status(403)
        .json({ error: "Only board users can view feedback trace bundles" });
      return;
    }
    const bundle = await feedback.getFeedbackTraceBundle(traceId);
    if (!bundle || !actorCanAccessCompany(req, bundle.companyId)) {
      res.status(404).json({ error: "Feedback trace not found" });
      return;
    }
    res.json(bundle);
  });

  // Resolving an unused chat is read-only. POST is used only by first send/upload.
  for (const method of ["get", "post"] as const) {
    router[method]("/companies/:companyId/chats/:agentRef", async (req, res) => {
      const companyId = req.params.companyId as string;
      assertCompanyAccess(req, companyId);
      if (req.actor.type !== "board" || !req.actor.userId) throw forbidden("Board user access required");
      if (!(await instanceSettings.getExperimental()).enableAgentChat) throw notFound("Agent Chat is disabled");
      const resolved = await agentsSvc.resolveByReference(companyId, req.params.agentRef as string);
      if (resolved.ambiguous) throw conflict("Agent reference is ambiguous");
      if (!resolved.agent) throw notFound("Agent not found");
      const agent = resolved.agent;
      const existing = await svc.getConversation(companyId, agent.id, req.actor.userId);

View on GitHub (pinned to 3f1d897a7c)