paperclipai/paperclip · error

A valid browser code is required.

Error message

A valid browser code is required.

What it means

Body guard on the setup-token login code exchange: exchanging the browser code requires a non-empty valid code in the request body, but it is missing or malformed, so the OAuth-style exchange is refused with 400 before any code is redeemed.

Source

Thrown at server/src/routes/agents.ts:5342

  ): Promise<void> => {
    const id = req.params.id as string;
    const agent = await getAccessibleResource(req, res, svc.getById(id), "Agent not found");
    if (!agent) return;

    if (req.actor.type === "agent") {
      if (req.actor.agentId !== id) {
        res.status(403).json({ error: "Agent can only invoke itself" });
        return;
      }
    } else {
      await assertBoardCanManageAgentsForCompany(req, agent.companyId);
    }
    if (req.body.debug?.providerTrace === "raw") {
      assertInstanceAdmin(req);
    }
    if (agent.orgChainHealth?.status === "invalid_org_chain") {
      res.status(409).json({
        error: agent.orgChainHealth?.repairGuidance ?? "Repair this agent's reporting chain before starting runs",
      });
      return;
    }

    const run = await heartbeat.wakeup(id, {
      source: opts.source,
      triggerDetail: req.body.triggerDetail ?? "manual",
      reason: req.body.reason ?? null,
      payload: req.actor.type === "agent" && req.body.payload
        ? { ...req.body.payload, commentId: undefined, wakeCommentId: undefined, wakeCommentIds: undefined }
        : req.body.payload ?? null,
      idempotencyKey: req.body.idempotencyKey ?? null,
      requestedByActorType: req.actor.type === "agent" ? "agent" : "user",
      requestedByActorId: req.actor.type === "agent" ? req.actor.agentId ?? null : req.actor.userId ?? null,
      contextSnapshot: {
        triggeredBy: req.actor.type,
        originIdentityContextId: req.actor.identityContextId ?? null,
        responsibleUserId: req.actor.type === "agent" ? req.actor.onBehalfOfUserId ?? null : req.actor.userId ?? null,

View on GitHub (pinned to 01ad858492)

Solutions

  1. Provide the valid browser code from the login flow and retry.
Defensive patterns

Strategy: validation

When it happens

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

Common situations: See trigger scenarios.


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