{"record":{"id":"5063643340a4f53a","repo":"paperclipai/paperclip","slug":"request-managedprofile-agentversion-must-be-a-cano","errorCode":null,"errorMessage":"request.managedProfile.agentVersion must be a canonical positive int32 string","messagePattern":"request\\.managedProfile\\.agentVersion must be a canonical positive int32 string","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/paperclip-runner/src/cli/eval-session-contract.ts","lineNumber":147,"sourceCode":"    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\",\n    ),\n    agentVersion,\n    environmentId: text(\n      profile.environmentId,\n      \"request.managedProfile.environmentId\",\n    ),\n    betaVersion: \"managed-agents-2026-04-01\",\n    maxSessionListCostUsd: positiveNumber(\n      profile.maxSessionListCostUsd,\n      \"request.managedProfile.maxSessionListCostUsd\",","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/packages/paperclip-runner/src/cli/eval-session-contract.ts#L129-L165","documentation":"Within parseManagedProfile, agentVersion must be a string of only digits 1-9 followed by digits (no leading zeros, no sign), whose numeric value fits in a signed int32 (<= 2147483647, checked via BigInt). Anything else — '0', '007', 'abc', '1.5', a number type, or an oversized value — throws this error.","triggerScenarios":"request.managedProfile.agentVersion is '0', has leading zeros, is negative, is a float string, is not a string at all (e.g. the number 42), or exceeds 2147483647.","commonSituations":"A caller sends agentVersion as a JSON number instead of a string; a version like 'v42' or '42.0' is passed through unnormalized; an upstream 64-bit id was assigned where only int32 is supported; a placeholder '0' was never replaced.","solutions":["Send agentVersion as a canonical decimal string: /^[1-9][0-9]*$/ and <= 2147483647","Convert numeric values with String(n) before submitting, after verifying they are positive int32","Normalize inputs by stripping non-digit prefixes ('v42' → '42') and rejecting leading zeros","If the real id exceeds int32, escalate — the managed-agents contract only supports int32 versions"],"exampleFix":"// before\n{ agentVersion: 42 }\n// after\n{ agentVersion: '42' }","handlingStrategy":"validation","validationCode":"function isCanonicalInt32String(v) {\n  return typeof v === 'string' && /^[1-9][0-9]*$/.test(v) && BigInt(v) <= 2147483647n;\n}\nif (!isCanonicalInt32String(req.managedProfile?.agentVersion)) {\n  throw new Error('agentVersion must be a canonical positive int32 string');\n}","typeGuard":"const isAgentVersion = (v) => typeof v === 'string' && /^[1-9][0-9]*$/.test(v) && BigInt(v) <= 2_147_483_647n;","tryCatchPattern":"try {\n  const request = parseEvalSessionRequest(raw);\n} catch (err) {\n  if (err.message.includes('canonical positive int32')) {\n    throw new RequestValidationError('agentVersion must be a digit string like \"42\" — no leading zeros, no floats, max 2147483647', { cause: err });\n  }\n  throw err;\n}","preventionTips":["Always serialize agentVersion as a string: String(n) after validating 0 < n <= 2147483647","Strip decoration like 'v' prefixes and reject floats before submission","Use the same regex/BigInt check in the producer that the contract uses","Escalate if upstream ids exceed int32 — do not attempt to truncate"],"tags":["validation","contract","versioning","int32"],"backgroundTag":"schema-validation-failed","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"}