{"record":{"id":"fe5fc4aec08cbc80","repo":"paperclipai/paperclip","slug":"a-valid-browser-code-is-required","errorCode":null,"errorMessage":"A valid browser code is required.","messagePattern":"A valid browser code is required\\.","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"server/src/routes/agents.ts","lineNumber":5708,"sourceCode":"  ): Promise<void> => {\n    const id = req.params.id as string;\n    const agent = await getAccessibleResource(req, res, svc.getById(id), \"Agent not found\");\n    if (!agent) return;\n\n    if (req.actor.type === \"agent\") {\n      if (req.actor.agentId !== id) {\n        res.status(403).json({ error: \"Agent can only invoke itself\" });\n        return;\n      }\n    } else {\n      await assertBoardCanWakeAgent(req, agent);\n    }\n    if (req.body.debug?.providerTrace === \"raw\") {\n      assertInstanceAdmin(req);\n    }\n    if (agent.orgChainHealth?.status === \"invalid_org_chain\") {\n      res.status(409).json({\n        error: agent.orgChainHealth?.repairGuidance ?? \"Repair this agent's reporting chain before starting runs\",\n      });\n      return;\n    }\n\n    let wakePayload = req.body.payload ?? null;\n    if (req.body.failedRunId) {\n      assertBoard(req);\n      if (\n        req.body.reason !== \"retry_failed_run\" ||\n        (opts.source ?? \"on_demand\") !== \"on_demand\" ||\n        (req.body.triggerDetail ?? \"manual\") !== \"manual\" ||\n        req.body.forceFreshSession === true ||\n        req.body.debug\n      ) {\n        throw badRequest(\n          \"An exact failed-run retry cannot override its execution context.\",\n        );\n      }","sourceCodeStart":5690,"sourceCodeEnd":5726,"githubUrl":"https://github.com/paperclipai/paperclip/blob/3f1d897a7c018d76563a21c6e39c3c9b03933622/server/src/routes/agents.ts#L5690-L5726","documentation":"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.","triggerScenarios":"Thrown at server/src/routes/agents.ts:4769 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide the valid browser code from the login flow and retry."],"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"}