{"record":{"id":"b0ae736897750af3","repo":"paperclipai/paperclip","slug":"request-managedprofile-betaversion-is-not-qualifie","errorCode":null,"errorMessage":"request.managedProfile.betaVersion is not qualified","messagePattern":"request\\.managedProfile\\.betaVersion is not qualified","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/paperclip-runner/src/cli/eval-session-contract.ts","lineNumber":137,"sourceCode":"    ? \"opencode_server\"\n    : provider === \"claude_managed\"\n      ? \"claude_managed_agents_api\"\n      : provider === \"aws_agentcore\"\n        ? \"aws_agentcore_harness_api\"\n    : provider === \"acpx\" ? \"acpx_runtime\" : \"codex_app_server\";\n}\n\nfunction positiveNumber(value: unknown, path: string): number {\n  if (typeof value !== \"number\" || !Number.isFinite(value) || value <= 0) {\n    throw new Error(`${path} must be a positive finite number`);\n  }\n  return value;\n}\n\nfunction parseManagedProfile(value: unknown): EvalSessionManagedProfile {\n  const profile = object(value, \"request.managedProfile\");\n  if (profile.betaVersion !== \"managed-agents-2026-04-01\") {\n    throw new Error(\"request.managedProfile.betaVersion is not qualified\");\n  }\n  const agentVersion = text(\n    profile.agentVersion,\n    \"request.managedProfile.agentVersion\",\n  );\n  if (\n    !/^[1-9][0-9]*$/.test(agentVersion) ||\n    BigInt(agentVersion) > 2_147_483_647n\n  ) {\n    throw new Error(\n      \"request.managedProfile.agentVersion must be a canonical positive int32 string\",\n    );\n  }\n  return {\n    profileId: text(profile.profileId, \"request.managedProfile.profileId\"),\n    anthropicAgentId: text(\n      profile.anthropicAgentId,\n      \"request.managedProfile.anthropicAgentId\",","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/packages/paperclip-runner/src/cli/eval-session-contract.ts#L119-L155","documentation":"parseManagedProfile enforces that request.managedProfile.betaVersion equals exactly 'managed-agents-2026-04-01'. This fail-closed pin prevents sessions from being created against unqualified or mismatched beta API versions. Any other value (or a missing field) throws this error.","triggerScenarios":"Calling parseEvalSessionRequest where request.managedProfile.betaVersion is absent, misspelled, uses a different date stamp (e.g. a newer or older beta version string), or has different casing/whitespace.","commonSituations":"The managed-agents API bumped its beta version string and the caller updated their SDK but not this pinned constant (or vice versa); a hardcoded profile in config predates the qualified version; a typo like 'managed-agents-2026-4-01'.","solutions":["Set request.managedProfile.betaVersion to exactly 'managed-agents-2026-04-01'","If the managed-agents API version legitimately changed, update both the caller and this pinned contract together","Remove surrounding whitespace and fix date formatting to the exact qualified string","Confirm the caller is targeting the managed-agents beta, not another Anthropic API surface"],"exampleFix":"// before\n{ betaVersion: 'managed-agents-2025-11-01', agentVersion: '42' }\n// after\n{ betaVersion: 'managed-agents-2026-04-01', agentVersion: '42' }","handlingStrategy":"validation","validationCode":"const QUALIFIED_BETA = 'managed-agents-2026-04-01';\nif (req.managedProfile?.betaVersion !== QUALIFIED_BETA) {\n  throw new Error(`betaVersion must be ${QUALIFIED_BETA}`);\n}","typeGuard":"function isQualifiedManagedProfile(p) {\n  return typeof p?.betaVersion === 'string' && p.betaVersion === 'managed-agents-2026-04-01';\n}","tryCatchPattern":"try {\n  const request = parseEvalSessionRequest(raw);\n} catch (err) {\n  if (err.message.includes('betaVersion is not qualified')) {\n    throw new VersionMismatchError('Managed-agents beta version pinned in this build: managed-agents-2026-04-01', { cause: err });\n  }\n  throw err;\n}","preventionTips":["Import the qualified beta version constant from the contract instead of hardcoding strings","When the managed-agents API bumps versions, update caller and contract in the same change","Trim and exact-match version strings; watch date formatting (zero-padded months)","Test profile construction against the pinned constant in CI"],"tags":["validation","versioning","contract"],"backgroundTag":"api-version-mismatch","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"}