{"record":{"id":"c94ae6ac336aff5b","repo":"paperclipai/paperclip","slug":"agentcore-profile-not-found","errorCode":"agentcore_profile_not_found","errorMessage":"The selected AWS AgentCore profile is not configured on this Runner Lab server.","messagePattern":"The selected AWS AgentCore profile is not configured on this Runner Lab server\\.","errorType":"http","errorClass":"RouteError","httpStatus":400,"severity":"error","filePath":"packages/paperclip-runner/scripts/capability-issue-thread-server.mjs","lineNumber":335,"sourceCode":"  return {\n    profileId,\n    anthropicAgentId,\n    agentVersion,\n    environmentId,\n    betaVersion: \"managed-agents-2026-04-01\",\n    maxSessionListCostUsd: configuration.maxSessionListCostUsd,\n  };\n}\n\nfunction resolveAgentCoreProfile(configuration) {\n  const required = (name) => {\n    const value = process.env[name]?.trim();\n    if (!value) throw new RouteError(503, \"agentcore_profile_unavailable\", `AWS AgentCore profile is missing ${name}. Run aws-agentcore:provision and aws-agentcore:lab.`);\n    return value;\n  };\n  const profileId = required(\"PAPERCLIP_AWS_AGENTCORE_PROFILE_ID\");\n  if (profileId !== configuration.agentCoreProfileId) {\n    throw new RouteError(400, \"agentcore_profile_not_found\", \"The selected AWS AgentCore profile is not configured on this Runner Lab server.\");\n  }\n  return {\n    profileId,\n    region: required(\"AWS_REGION\"),\n    accountId: required(\"PAPERCLIP_AWS_AGENTCORE_ACCOUNT_ID\"),\n    harnessArn: required(\"PAPERCLIP_AWS_AGENTCORE_HARNESS_ARN\"),\n    harnessVersion: required(\"PAPERCLIP_AWS_AGENTCORE_HARNESS_VERSION\"),\n    endpointArn: required(\"PAPERCLIP_AWS_AGENTCORE_ENDPOINT_ARN\"),\n    endpointQualifier: required(\"PAPERCLIP_AWS_AGENTCORE_ENDPOINT_QUALIFIER\"),\n    agentRuntimeArn: required(\"PAPERCLIP_AWS_AGENTCORE_RUNTIME_ARN\"),\n    memoryArn: required(\"PAPERCLIP_AWS_AGENTCORE_MEMORY_ARN\"),\n    memoryId: required(\"PAPERCLIP_AWS_AGENTCORE_MEMORY_ID\"),\n    invocationRoleArn: required(\"PAPERCLIP_AWS_AGENTCORE_INVOCATION_ROLE_ARN\"),\n    contextBucket: required(\"PAPERCLIP_AWS_AGENTCORE_CONTEXT_BUCKET\"),\n    contextPrefix: required(\"PAPERCLIP_AWS_AGENTCORE_CONTEXT_PREFIX\"),\n    contextKmsKeyArn: required(\"PAPERCLIP_AWS_AGENTCORE_CONTEXT_KMS_KEY_ARN\"),\n    qualificationRevision: required(\"PAPERCLIP_AWS_AGENTCORE_QUALIFICATION_REVISION\"),\n    eventExpiryDays: 90,","sourceCodeStart":317,"sourceCodeEnd":353,"githubUrl":"https://github.com/paperclipai/paperclip/blob/5716fe907e596ce73501408fc6efdb19fb61edf2/packages/paperclip-runner/scripts/capability-issue-thread-server.mjs#L317-L353","documentation":"After required() confirms the profile ID env var exists, resolveAgentCoreProfile compares it with configuration.agentCoreProfileId from the request. An exact !== mismatch means the requested AWS AgentCore profile is not the one this Runner Lab server has provisioned, producing a 400 agentcore_profile_not_found. Like the Claude Managed equivalent, it separates 'profile unknown to this server' from 'server not provisioned' (the 503 case).","triggerScenarios":"Client sends configuration.agentCoreProfileId=\"prof-old\" while the server env PAPERCLIP_AWS_AGENTCORE_PROFILE_ID is \"prof-new\" (after trim); exact string comparison, so case/whitespace differences also fail.","commonSituations":"Profile re-provisioned with a new ID but clients kept the old one; dev and prod servers each host different profiles and a client config crosses environments; manual edit of the env var introducing a typo or trailing space; stale UI cache of profile IDs.","solutions":["Update the request's agentCoreProfileId to exactly match the server's PAPERCLIP_AWS_AGENTCORE_PROFILE_ID env value.","Re-fetch the server's configured profile (via lab/status endpoints or config) and refresh any cached client/UI profile list.","Check for exact-match pitfalls: the comparison is case-sensitive and happens after trimming the env value only, so normalize client input too.","Point the client at the Runner Lab server that actually hosts the requested profile, or re-run aws-agentcore:provision to host the desired profile here."],"exampleFix":"// before\nPAPERCLIP_AWS_AGENTCORE_PROFILE_ID=prof-new\nclient: { \"agentCoreProfileId\": \"prof-old\" }\n// after\nclient: { \"agentCoreProfileId\": \"prof-new\" }","handlingStrategy":"validation","validationCode":"const serverProfile = process.env.PAPERCLIP_AWS_AGENTCORE_PROFILE_ID?.trim();\nif (serverProfile && serverProfile !== requested.agentCoreProfileId) {\n  throw new Error(`Requested AgentCore profile ${requested.agentCoreProfileId} not hosted here; server hosts ${serverProfile}`);\n}","typeGuard":"function isHostedAgentCoreProfile(requestedId, serverEnv = process.env) {\n  const hosted = serverEnv.PAPERCLIP_AWS_AGENTCORE_PROFILE_ID?.trim();\n  return !hosted || hosted === requestedId;\n}","tryCatchPattern":"try {\n  await configureHarness(cfg);\n} catch (e) {\n  if (e.code === \"agentcore_profile_not_found\") {\n    cfg.agentCoreProfileId = process.env.PAPERCLIP_AWS_AGENTCORE_PROFILE_ID?.trim();\n    await configureHarness(cfg);\n  } else throw e;\n}","preventionTips":["Fetch the hosted profile ID from the server at session start instead of caching it in clients.","Normalize (trim, case) profile IDs on both client and server before comparing.","Re-sync client configs whenever the server's AgentCore profile is re-provisioned.","Distinguish per-environment profile IDs in config to avoid cross-env mismatches."],"tags":["configuration","profile-mismatch","aws","agentcore","request-400"],"backgroundTag":"profile-not-configured","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"}