{"record":{"id":"1b984f558b4951e5","repo":"paperclipai/paperclip","slug":"paperclip-runner-aws-agentcore-profile-mismatch","errorCode":"paperclip_runner_aws_agentcore_profile_mismatch","errorMessage":"The qualified AWS AgentCore profile does not match the adapter selection.","messagePattern":"The qualified AWS AgentCore profile does not match the adapter selection\\.","errorType":"error_code","errorClass":"PaperclipRunnerProviderProfileError","httpStatus":null,"severity":"error","filePath":"server/src/services/native-runtime/provider-profile.ts","lineNumber":545,"sourceCode":"        profileId: stored.id,\n        anthropicAgentId: stored.anthropicAgentId,\n        agentVersion: stored.agentVersion,\n        environmentId: stored.environmentId,\n        betaVersion: CLAUDE_MANAGED_BETA_VERSION,\n      },\n      maxSessionListCostUsd,\n    };\n  }\n  if (profile.provider === \"aws_agentcore\") {\n    const stored = input.agentCoreProfile;\n    if (\n      !stored\n      || (\n        profile.agentCoreProfileId !== stored.id\n        && profile.agentCoreProfileId !== stored.profileKey\n      )\n    ) {\n      throw new PaperclipRunnerProviderProfileError(\n        \"paperclip_runner_aws_agentcore_profile_mismatch\",\n        \"The qualified AWS AgentCore profile does not match the adapter selection.\",\n      );\n    }\n    const remote = asRecord(stored.configuration);\n    const required = (key: string): string => {\n      const value = optionalString(remote[key]);\n      if (!value) {\n        throw new PaperclipRunnerProviderProfileError(\n          \"paperclip_runner_aws_agentcore_profile_invalid\",\n          `The qualified AWS AgentCore profile is missing ${key}.`,\n        );\n      }\n      return value;\n    };\n    if (remote.eventExpiryDays !== 90) {\n      throw new PaperclipRunnerProviderProfileError(\n        \"paperclip_runner_aws_agentcore_retention_unqualified\",","sourceCodeStart":527,"sourceCodeEnd":563,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/server/src/services/native-runtime/provider-profile.ts#L527-L563","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Update the adapter config's agentCoreProfileId to the current profile id or profileKey.","Recreate the deleted AgentCore profile with the same id/profileKey, or re-select the profile in the agent's adapter settings.","Restore the missing profile row via the AgentCore profile qualification flow (provider-profile-qualification.ts).","Check company scoping — the profile exists but belongs to a different company, so it isn't loaded for this run."],"exampleFix":"// before\nproviderProfile: { provider: \"aws_agentcore\", agentCoreProfileId: \"old-key\" }\n// after (profileKey was renamed)\nproviderProfile: { provider: \"aws_agentcore\", agentCoreProfileId: \"prod-agentcore\" }","handlingStrategy":"validation","validationCode":"if (profile.provider === \"aws_agentcore\") {\n  const stored = await loadAgentCoreProfile(profile.agentCoreProfileId); // by id or profileKey\n  if (!stored) throw new Error(`No qualified AgentCore profile matches \"${profile.agentCoreProfileId}\" for this company`);\n}","typeGuard":"const matchesStoredProfile = (\n  profileId: string,\n  stored: { id: string; profileKey: string } | null | undefined,\n): stored is { id: string; profileKey: string } =>\n  !!stored && (profileId === stored.id || profileId === stored.profileKey);","tryCatchPattern":"try {\n  await executeRun(run);\n} catch (e) {\n  if (e instanceof PaperclipRunnerProviderProfileError && e.code === \"paperclip_runner_aws_agentcore_profile_mismatch\") {\n    const stored = await listQualifiedAgentCoreProfiles(companyId);\n    throw new Error(`Re-select an AgentCore profile in adapter settings; valid keys: ${stored.map(p => p.profileKey).join(\", \")}`);\n  }\n  throw e;\n}","preventionTips":["Never rename profileKey while adapter configs reference it; migrate configs first","Re-select the profile in adapter settings after deleting/recreating one","Verify company scoping — the profile must belong to the run's company","Validate agentCoreProfileId against the profile list at config save time in the UI"],"tags":["configuration","profile-mismatch","aws-agentcore","provider-profile"],"backgroundTag":"provider-profile-not-qualified","analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-09-02T18:44:00.616Z","contentChangedAt":"2026-09-02T18:44:00.616Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}