paperclipai/paperclip · error · PaperclipRunnerProviderProfileError

paperclip_runner_aws_agentcore_profile_mismatch

paperclip_runner_aws_agentcore_profile_mismatch

Error message

The qualified AWS AgentCore profile does not match the adapter selection.

What it means

For the aws_agentcore backend, the run must reference a stored, qualified AgentCore profile: the adapter's agentCoreProfileId must equal the stored profile's id or profileKey, and a stored profile must exist. Otherwise resolvePaperclipRunnerNativeProviderInput throws, preventing execution against an unqualified or renamed AgentCore deployment.

Solutions

  1. Update the adapter config's agentCoreProfileId to the current profile id or profileKey.
  2. Recreate the deleted AgentCore profile with the same id/profileKey, or re-select the profile in the agent's adapter settings.
  3. Restore the missing profile row via the AgentCore profile qualification flow (provider-profile-qualification.ts).
  4. Check company scoping — the profile exists but belongs to a different company, so it isn't loaded for this run.

Example fix

// before
providerProfile: { provider: "aws_agentcore", agentCoreProfileId: "old-key" }
// after (profileKey was renamed)
providerProfile: { provider: "aws_agentcore", agentCoreProfileId: "prod-agentcore" }
Defensive patterns

Strategy: validation

Validate before calling

if (profile.provider === "aws_agentcore") {
  const stored = await loadAgentCoreProfile(profile.agentCoreProfileId); // by id or profileKey
  if (!stored) throw new Error(`No qualified AgentCore profile matches "${profile.agentCoreProfileId}" for this company`);
}

Type guard

const matchesStoredProfile = (
  profileId: string,
  stored: { id: string; profileKey: string } | null | undefined,
): stored is { id: string; profileKey: string } =>
  !!stored && (profileId === stored.id || profileId === stored.profileKey);

Try / catch

try {
  await executeRun(run);
} catch (e) {
  if (e instanceof PaperclipRunnerProviderProfileError && e.code === "paperclip_runner_aws_agentcore_profile_mismatch") {
    const stored = await listQualifiedAgentCoreProfiles(companyId);
    throw new Error(`Re-select an AgentCore profile in adapter settings; valid keys: ${stored.map(p => p.profileKey).join(", ")}`);
  }
  throw e;
}

Prevention

When it happens

Trigger: A run with provider=aws_agentcore where input.agentCoreProfile is null (no profile row found), or profile.agentCoreProfileId matches neither stored.id nor stored.profileKey — e.g. after renaming the profileKey or deleting/recreating the profile.

Common situations: Adapter config copied between companies/instances referencing a profile that doesn't exist locally; an operator renaming profileKey in the AgentCore admin UI while saved adapter configs still use the old key; a deleted profile still selected in an agent's adapter config.

Related errors


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

Appendix: source

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

        profileId: stored.id,
        anthropicAgentId: stored.anthropicAgentId,
        agentVersion: stored.agentVersion,
        environmentId: stored.environmentId,
        betaVersion: CLAUDE_MANAGED_BETA_VERSION,
      },
      maxSessionListCostUsd,
    };
  }
  if (profile.provider === "aws_agentcore") {
    const stored = input.agentCoreProfile;
    if (
      !stored
      || (
        profile.agentCoreProfileId !== stored.id
        && profile.agentCoreProfileId !== stored.profileKey
      )
    ) {
      throw new PaperclipRunnerProviderProfileError(
        "paperclip_runner_aws_agentcore_profile_mismatch",
        "The qualified AWS AgentCore profile does not match the adapter selection.",
      );
    }
    const remote = asRecord(stored.configuration);
    const required = (key: string): string => {
      const value = optionalString(remote[key]);
      if (!value) {
        throw new PaperclipRunnerProviderProfileError(
          "paperclip_runner_aws_agentcore_profile_invalid",
          `The qualified AWS AgentCore profile is missing ${key}.`,
        );
      }
      return value;
    };
    if (remote.eventExpiryDays !== 90) {
      throw new PaperclipRunnerProviderProfileError(
        "paperclip_runner_aws_agentcore_retention_unqualified",

View on GitHub (pinned to 01ad858492)