{"record":{"id":"9397b11143c1cc87","repo":"paperclipai/paperclip","slug":"model-must-be-the-qualified-managed-agents-model","errorCode":null,"errorMessage":"--model must be the qualified Managed Agents model ${CLAUDE_MANAGED_QUALIFIED_MODEL}","messagePattern":"--model must be the qualified Managed Agents model (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/commands/managed-agent.ts","lineNumber":83,"sourceCode":"  options: ManagedAgentSetupOptions,\n  env: NodeJS.ProcessEnv = process.env,\n): ValidatedSetup {\n  const anthropicApiKey = env.ANTHROPIC_API_KEY?.trim();\n  if (!anthropicApiKey) {\n    throw new Error(\"ANTHROPIC_API_KEY is required in the CLI process environment\");\n  }\n  if (!options.acknowledgeRetention) {\n    throw new Error(\n      \"Pass --acknowledge-retention to enable the stateful beta Managed Agents service\",\n    );\n  }\n\n  const profileKey = required(options.profileKey, \"--profile-key\");\n  const displayName = required(options.displayName, \"--display-name\");\n  const apiKeySecretId = required(options.apiKeySecretId, \"--api-key-secret-id\");\n  const model = required(options.model, \"--model\");\n  if (model !== CLAUDE_MANAGED_QUALIFIED_MODEL) {\n    throw new Error(\n      `--model must be the qualified Managed Agents model ${CLAUDE_MANAGED_QUALIFIED_MODEL}`,\n    );\n  }\n  if (!UUID_RE.test(apiKeySecretId)) {\n    throw new Error(\"--api-key-secret-id must be a UUID\");\n  }\n\n  const defaultMaxListCostUsd = Number(options.maxSessionListCostUsd);\n  const cents = Math.round(defaultMaxListCostUsd * 100);\n  if (\n    !Number.isFinite(defaultMaxListCostUsd)\n    || defaultMaxListCostUsd <= 0\n    || !Number.isSafeInteger(cents)\n    || cents <= 0\n  ) {\n    throw new Error(\"--max-session-list-cost-usd must resolve to at least one cent\");\n  }\n","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/paperclipai/paperclip/blob/5716fe907e596ce73501408fc6efdb19fb61edf2/cli/src/commands/managed-agent.ts#L65-L101","documentation":"The Managed Agents beta only accepts the single qualified model id `claude-sonnet-5` exported as CLAUDE_MANAGED_QUALIFIED_MODEL. `validateManagedAgentSetup` throws this when the `--model` value is present but is not exactly that string. Aliases, snapshots, or newer model names are rejected client-side before any API call.","triggerScenarios":"Passing `--model claude-sonnet-5-20260101`, `--model claude-sonnet-4-5`, `--model sonnet`, or any dated/alias variant; copying a --model value from a non-managed-agent command; hardcoding a model string in a script that predates the qualified-model requirement.","commonSituations":"Reusing flags from other Anthropic-based commands where dated model ids are the norm; upgrading the CLI and the pinned qualified model changed; fat-fingering the model name.","solutions":["Use exactly --model claude-sonnet-5","Import/reference CLAUDE_MANAGED_QUALIFIED_MODEL when building the command programmatically instead of hardcoding","Check the CLI version's exported constant if unsure which model is current","Remove dated model suffixes or aliases from templates and scripts"],"exampleFix":"// before\nconst args = [...base, \"--model\", \"claude-sonnet-5-20260101\"];\n// after\nimport { CLAUDE_MANAGED_QUALIFIED_MODEL } from \"./managed-agent.js\";\nconst args = [...base, \"--model\", CLAUDE_MANAGED_QUALIFIED_MODEL];","handlingStrategy":"validation","validationCode":"import { CLAUDE_MANAGED_QUALIFIED_MODEL } from \"./managed-agent.js\";\nif (model !== CLAUDE_MANAGED_QUALIFIED_MODEL) {\n  throw new Error(`Managed Agents require --model ${CLAUDE_MANAGED_QUALIFIED_MODEL}, got ${model}`);\n}","typeGuard":"function isQualifiedManagedModel(m: string): m is typeof CLAUDE_MANAGED_QUALIFIED_MODEL {\n  return m === CLAUDE_MANAGED_QUALIFIED_MODEL;\n}","tryCatchPattern":"try {\n  await setupManagedAgent(opts);\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith(\"--model must be\")) {\n    console.error(`Use --model ${CLAUDE_MANAGED_QUALIFIED_MODEL}`); process.exitCode = 2;\n  } else throw err;\n}","preventionTips":["Reference the exported CLAUDE_MANAGED_QUALIFIED_MODEL constant instead of hardcoding strings","Never reuse --model values from other Anthropic commands in managed-agent invocations","Strip dated suffixes/aliases from model config templates","Pin the CLI version so the expected qualified model is known"],"tags":["cli","validation","model-id","anthropic"],"backgroundTag":"invalid-model-id","analyzedSha":"5716fe907e596ce73501408fc6efdb19fb61edf2","analyzedAt":"2026-09-02T18:44:00.616Z","contentChangedAt":"2026-09-02T18:44:00.616Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}