paperclipai/paperclip · error · PaperclipRunnerProviderProfileError

paperclip_runner_claude_managed_model_invalid

paperclip_runner_claude_managed_model_invalid

Error message

The Claude Managed profile requires a model.

What it means

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.

Source

Thrown at server/src/services/native-runtime/provider-profile.ts:506

        && profile.managedProfileId !== stored.profileKey
      )
    ) {
      throw new PaperclipRunnerProviderProfileError(
        "paperclip_runner_claude_managed_profile_mismatch",
        "The qualified Claude Managed profile does not match the adapter selection.",
      );
    }
    if (stored.betaVersion !== CLAUDE_MANAGED_BETA_VERSION) {
      throw new PaperclipRunnerProviderProfileError(
        "paperclip_runner_claude_managed_beta_unqualified",
        "The Claude Managed profile beta version is not qualified.",
      );
    }
    const model = profile.model ?? optionalString(stored.defaultModel);
    const maxSessionListCostUsd = profile.maxSessionListCostUsd
      ?? stored.defaultMaxListCostCents / 100;
    if (!model) {
      throw new PaperclipRunnerProviderProfileError(
        "paperclip_runner_claude_managed_model_invalid",
        "The Claude Managed profile requires a model.",
      );
    }
    if (model !== CLAUDE_MANAGED_QUALIFIED_MODEL) {
      throw new PaperclipRunnerProviderProfileError(
        "paperclip_runner_claude_managed_model_unqualified",
        `The Claude Managed profile requires exact model ${CLAUDE_MANAGED_QUALIFIED_MODEL}.`,
      );
    }
    if (!Number.isFinite(maxSessionListCostUsd) || maxSessionListCostUsd <= 0) {
      throw new PaperclipRunnerProviderProfileError(
        "paperclip_runner_claude_managed_spend_cap_invalid",
        "The Claude Managed profile requires a positive session spend ceiling.",
      );
    }
    return {
      provider: "claude_managed",

View on GitHub (pinned to 01ad858492)

Solutions

  1. Set model in the adapter's managed profile selection config to 'claude-sonnet-5'.
  2. Set defaultModel on the stored managed agent profile (managed-agent profile service/API) so runs inherit it.
  3. Re-run the managed agent setup flow (paperclip managed-agent setup) which sets defaultModel alongside agentId/environmentId.
  4. Verify the profile row in the DB is not missing defaultModel after a restore/migration.

Example fix

// before (adapter config)
providerProfile: { provider: "claude_managed", managedProfileId: "acme-managed" }
// after
providerProfile: { provider: "claude_managed", managedProfileId: "acme-managed", model: "claude-sonnet-5" }
Defensive patterns

Strategy: validation

Validate before calling

const model = profile.model ?? storedProfile.defaultModel;
if (!model) {
  throw new Error("Set model on the adapter profile or defaultModel on the stored managed profile before running");
}

Type guard

const hasManagedModel = (p: { model?: string | null }, s: { defaultModel?: string | null }): p is { model: string } =>
  Boolean(p.model ?? s.defaultModel);

Try / catch

try {
  await executeRun(run);
} catch (e) {
  if (e instanceof PaperclipRunnerProviderProfileError && e.code === "paperclip_runner_claude_managed_model_invalid") {
    await managedProfileService.update(profileId, { defaultModel: CLAUDE_MANAGED_QUALIFIED_MODEL });
    return executeRun(run);
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of paperclipai/paperclip@01ad858492 (2026-09-02). Data as JSON: /api/errors/715006f3524ac0a4. Report an issue: GitHub.