paperclipai/paperclip · error

Agent run context required

Error message

Agent run context required

What it means

Context guard in the decision-archive-proposal route: creating a decision archive proposal requires an authenticated agent run context (the proposing agent), but agentContext(req) returned null — the caller is not a valid agent actor — so the proposal is refused.

Source

Thrown at server/src/routes/decisions.ts:63

}

function boardUserId(req: Parameters<typeof getActorInfo>[0]) {
  assertBoard(req);
  return req.actor.userId ?? "local-implicit-board";
}

export function decisionRoutes(db: Db, options: DecisionServiceOptions) {
  const router = Router();
  const svc = decisionService(db, options);
  router.post(
    "/companies/:companyId/decision-archive-proposals",
    validate(createDecisionArchiveProposalSchema),
    async (req, res) => {
      const companyId = req.params.companyId as string;
      assertCompanyAccess(req, companyId);
      const agent = agentContext(req);
      if (!agent) {
        res.status(403).json({ error: "Agent run context required" });
        return;
      }
      const access = await authorizationService(db).decide({
        actor: req.actor,
        action: "decision_triage:manage",
        resource: { type: "company", companyId },
      });
      if (!access.allowed) throw forbidden(access.explanation, authorizationDeniedDetails(access));

      const proposal = req.body as CreateDecisionArchiveProposalInput;
      const requested = new Map<string, CreateDecisionArchiveProposalInput["items"][number]>(proposal.items.map((item) => [
        `${item.sourceKind}:${item.sourceId}`,
        item,
      ]));
      const found = new Map<string, AttentionItem>();
      const snapshot = await db.transaction(async (tx) => attentionService(tx as unknown as Db).list(companyId, {
        includeDismissed: true,
        all: true,

View on GitHub (pinned to a7e689b3c3)

Solutions

  1. Include the required field(s) in the request path, query, or body as named by the error message, then retry.
  2. Check the API contract in packages/shared validators for the exact required shape of this endpoint.
Defensive patterns

Strategy: validation

When it happens

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

Common situations: See trigger scenarios.


AI-assisted analysis of paperclipai/paperclip@a7e689b3c3 (2026-08-18). Data as JSON: /api/errors/0ef5e17a340d07c7. Report an issue: GitHub.