{"record":{"id":"a42acb267e0d65ca","repo":"paperclipai/paperclip","slug":"agent-not-found-agentref-a42acb","errorCode":null,"errorMessage":"Agent not found: ${agentRef}","messagePattern":"Agent not found: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/client/skills.ts","lineNumber":742,"sourceCode":"  const rows: Array<{ skill: CompanySkillReferenceTarget; audit: CompanySkillAuditResult }> = [];\n  for (const skill of selected) {\n    const audit = await ctx.api.post<CompanySkillAuditResult>(\n      `/api/companies/${ctx.companyId}/skills/${encodeURIComponent(skill.id)}/audit`,\n      {},\n    );\n    if (!audit) {\n      throw new Error(`No audit result returned for skill ${skill.key}.`);\n    }\n    rows.push({ skill: toSkillReferenceTarget(skill), audit });\n  }\n  return rows;\n}\n\nasync function resolveAgent(ctx: ResolvedClientContext, agentRef: string): Promise<Agent> {\n  const params = new URLSearchParams({ companyId: ctx.companyId ?? \"\" });\n  const agent = await ctx.api.get<Agent>(`/api/agents/${encodeURIComponent(agentRef)}?${params.toString()}`);\n  if (!agent) {\n    throw new Error(`Agent not found: ${agentRef}`);\n  }\n  return agent;\n}\n\nfunction printCompanySkillRows(rows: Array<CompanySkillListItem | CompanySkill>): void {\n  if (rows.length === 0) {\n    printOutput([], { json: false });\n    return;\n  }\n  for (const row of rows) {\n    console.log(\n      formatInlineRecord({\n        id: row.id,\n        key: row.key,\n        slug: row.slug,\n        name: row.name,\n        source: \"sourceBadge\" in row ? row.sourceBadge : row.sourceType,\n        trust: row.trustLevel,","sourceCodeStart":724,"sourceCodeEnd":760,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/client/skills.ts#L724-L760","documentation":"Thrown by resolveAgent() when GET /api/agents/{agentRef}?companyId=... returns null/undefined. The resolver backs `skills agent list|sync|clear`, which need a concrete agent id to hit the agent skill endpoints. A null body means the server did not find an agent matching the ref within the company scope.","triggerScenarios":"`paperclipai skills agent list <agentRef>`, `... sync <agentRef>`, or `... clear <agentRef>` where agentRef is a typo, belongs to another company, or is a shortname that is not unique/known to the server.","commonSituations":"Wrong company scope (PAPERCLIP_COMPANY_ID), archived agent, stale shortname after rename, or using an agent id from a different deployment.","solutions":["Confirm the agent exists in the target company (e.g. via a company agents listing).","Use the full agent id rather than a shortname/url-key to avoid ambiguity.","Verify --company-id matches the company the agent belongs to."],"exampleFix":"// before\nawait run([\"skills\", \"agent\", \"list\", shortName]);\n// after\nconst agents = await runJson([\"company\", \"agents\", \"--json\"]); // or equivalent listing\nconst agent = agents.find(a => a.id === agentId);\nawait run([\"skills\", \"agent\", \"list\", agent.id]);","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await run([\"skills\", \"agent\", \"list\", agentRef]);\n} catch (err) {\n  if (err instanceof Error && /Agent not found/.test(err.message)) {\n    console.error(`${agentRef} not found in this company. Use the full agent id.`);\n    process.exit(2);\n  }\n  throw err;\n}","preventionTips":["Use full agent ids rather than shortnames to avoid ambiguity.","Confirm --company-id matches the agent's company.","List agents first and pass a verified id."],"tags":["cli","not-found","agent","skills","resolution"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}