{"record":{"id":"aa4430e1f438242d","repo":"paperclipai/paperclip","slug":"agent-authentication-failed","errorCode":null,"errorMessage":"Agent authentication failed","messagePattern":"Agent authentication failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/commands/client/prompt.ts","lineNumber":123,"sourceCode":"          handleCommandError(err);\n        }\n      }),\n    { includeCompany: false },\n  );\n}\n\nexport async function runAgentPrompt(\n  agentRef: string | undefined,\n  prompt: string,\n  opts: PromptOptions,\n): Promise<PromptResult> {\n  const ctx = resolveCommandContext(opts);\n  if (ctx.profile.persona && ctx.profile.persona !== \"agent\") {\n    throw new Error(`Profile '${ctx.profileName}' is persona=${ctx.profile.persona}; use an agent profile or board prompt.`);\n  }\n  const body = normalizePrompt(prompt);\n  const me = await ctx.api.get<Agent>(\"/api/agents/me\");\n  if (!me) throw new Error(\"Agent authentication failed\");\n  const expectedRef = agentRef?.trim() || ctx.profile.agentId || me.id;\n  assertAgentMatchesReference(me, expectedRef);\n\n  const result = await createOrCommentForAgent({\n    api: ctx.api,\n    actor: \"agent\",\n    agent: me,\n    companyId: me.companyId,\n    prompt: body,\n    issueId: opts.issue,\n    title: opts.title,\n    wake: opts.wake !== false,\n  });\n  return result;\n}\n\nexport async function runBoardPrompt(\n  agentRef: string,","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/cli/src/commands/client/prompt.ts#L105-L141","documentation":"The /api/agents/me lookup in runAgentPrompt failed or returned null, meaning the credential is not a valid/scoped agent key; a guard on agent self-identification.","triggerScenarios":"Thrown at cli/src/commands/client/prompt.ts:123 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the agent API key/token for the profile and re-authenticate."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}