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.

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@3f1d897a7c (2026-08-18). Data as JSON: /api/errors/fe5fc4aec08cbc80. Report an issue: GitHub.

Appendix: source

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

  ): 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 assertBoardCanWakeAgent(req, agent);
    }
    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;
    }

    let wakePayload = req.body.payload ?? null;
    if (req.body.failedRunId) {
      assertBoard(req);
      if (
        req.body.reason !== "retry_failed_run" ||
        (opts.source ?? "on_demand") !== "on_demand" ||
        (req.body.triggerDetail ?? "manual") !== "manual" ||
        req.body.forceFreshSession === true ||
        req.body.debug
      ) {
        throw badRequest(
          "An exact failed-run retry cannot override its execution context.",
        );
      }

View on GitHub (pinned to 3f1d897a7c)