{"record":{"id":"715006f3524ac0a4","repo":"paperclipai/paperclip","slug":"paperclip-runner-claude-managed-model-invalid","errorCode":"paperclip_runner_claude_managed_model_invalid","errorMessage":"The Claude Managed profile requires a model.","messagePattern":"The Claude Managed profile requires a model\\.","errorType":"error_code","errorClass":"PaperclipRunnerProviderProfileError","httpStatus":null,"severity":"error","filePath":"server/src/services/native-runtime/provider-profile.ts","lineNumber":506,"sourceCode":"        && profile.managedProfileId !== stored.profileKey\n      )\n    ) {\n      throw new PaperclipRunnerProviderProfileError(\n        \"paperclip_runner_claude_managed_profile_mismatch\",\n        \"The qualified Claude Managed profile does not match the adapter selection.\",\n      );\n    }\n    if (stored.betaVersion !== CLAUDE_MANAGED_BETA_VERSION) {\n      throw new PaperclipRunnerProviderProfileError(\n        \"paperclip_runner_claude_managed_beta_unqualified\",\n        \"The Claude Managed profile beta version is not qualified.\",\n      );\n    }\n    const model = profile.model ?? optionalString(stored.defaultModel);\n    const maxSessionListCostUsd = profile.maxSessionListCostUsd\n      ?? stored.defaultMaxListCostCents / 100;\n    if (!model) {\n      throw new PaperclipRunnerProviderProfileError(\n        \"paperclip_runner_claude_managed_model_invalid\",\n        \"The Claude Managed profile requires a model.\",\n      );\n    }\n    if (model !== CLAUDE_MANAGED_QUALIFIED_MODEL) {\n      throw new PaperclipRunnerProviderProfileError(\n        \"paperclip_runner_claude_managed_model_unqualified\",\n        `The Claude Managed profile requires exact model ${CLAUDE_MANAGED_QUALIFIED_MODEL}.`,\n      );\n    }\n    if (!Number.isFinite(maxSessionListCostUsd) || maxSessionListCostUsd <= 0) {\n      throw new PaperclipRunnerProviderProfileError(\n        \"paperclip_runner_claude_managed_spend_cap_invalid\",\n        \"The Claude Managed profile requires a positive session spend ceiling.\",\n      );\n    }\n    return {\n      provider: \"claude_managed\",","sourceCodeStart":488,"sourceCodeEnd":524,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/server/src/services/native-runtime/provider-profile.ts#L488-L524","documentation":"For the claude_managed backend, the model is resolved as profile.model ?? stored.defaultModel. Both the run-level adapter profile and the stored managed agent profile can omit it; without any model, Paperclip cannot build the Managed Agents run request, so resolvePaperclipRunnerNativeProviderInput throws. The profile must name a concrete model before a run can proceed.","triggerScenarios":"A run targets provider=claude_managed where the adapter config's managed profile object has no model, and the stored profile row's defaultModel column is null/empty string.","commonSituations":"Creating a managed agent profile without running the CLI's model validation (validateManagedAgentSetup); a profile seeded directly into the DB with defaultModel omitted; an adapter config that intentionally clears the model override while the stored profile also lacks a default.","solutions":["Set model in the adapter's managed profile selection config to 'claude-sonnet-5'.","Set defaultModel on the stored managed agent profile (managed-agent profile service/API) so runs inherit it.","Re-run the managed agent setup flow (paperclip managed-agent setup) which sets defaultModel alongside agentId/environmentId.","Verify the profile row in the DB is not missing defaultModel after a restore/migration."],"exampleFix":"// before (adapter config)\nproviderProfile: { provider: \"claude_managed\", managedProfileId: \"acme-managed\" }\n// after\nproviderProfile: { provider: \"claude_managed\", managedProfileId: \"acme-managed\", model: \"claude-sonnet-5\" }","handlingStrategy":"validation","validationCode":"const model = profile.model ?? storedProfile.defaultModel;\nif (!model) {\n  throw new Error(\"Set model on the adapter profile or defaultModel on the stored managed profile before running\");\n}","typeGuard":"const hasManagedModel = (p: { model?: string | null }, s: { defaultModel?: string | null }): p is { model: string } =>\n  Boolean(p.model ?? s.defaultModel);","tryCatchPattern":"try {\n  await executeRun(run);\n} catch (e) {\n  if (e instanceof PaperclipRunnerProviderProfileError && e.code === \"paperclip_runner_claude_managed_model_invalid\") {\n    await managedProfileService.update(profileId, { defaultModel: CLAUDE_MANAGED_QUALIFIED_MODEL });\n    return executeRun(run);\n  }\n  throw e;\n}","preventionTips":["Always set defaultModel when creating a managed agent profile","Use the CLI setup flow (validateManagedAgentSetup) instead of direct DB seeding","Validate adapter configs in CI: reject claude_managed profiles with no model anywhere in the chain"],"tags":["configuration","missing-model","claude-managed","provider-profile"],"backgroundTag":"missing-config-field","analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-09-02T18:44:00.616Z","contentChangedAt":"2026-09-02T18:44:00.616Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}