{"record":{"id":"31a61f2bf965b2cb","repo":"paperclipai/paperclip","slug":"invalid-spend-cap","errorCode":"invalid_spend_cap","errorMessage":"Claude Managed requires a positive session spend ceiling.","messagePattern":"Claude Managed requires a positive session spend ceiling\\.","errorType":"http","errorClass":"RouteError","httpStatus":400,"severity":"error","filePath":"packages/paperclip-runner/scripts/capability-issue-thread-server.mjs","lineNumber":249,"sourceCode":"    if (model !== ACPX_QUALIFIED_MODELS[acpxAgent]) {\n      throw new RouteError(400, \"invalid_model\", `The qualified ACPX ${acpxAgent} profile requires exact model ${ACPX_QUALIFIED_MODELS[acpxAgent]}.`);\n    }\n  }\n  const requestedManagedProfileId = source.managedProfileId === undefined || source.managedProfileId === null\n    ? \"default\"\n    : String(source.managedProfileId).trim();\n  const configuredManagedProfileId = process.env.PAPERCLIP_CLAUDE_MANAGED_PROFILE_ID?.trim();\n  const managedProfileId = provider === \"claude_managed\" && requestedManagedProfileId === \"default\" && configuredManagedProfileId\n    ? configuredManagedProfileId\n    : requestedManagedProfileId;\n  const maxSessionListCostUsd = source.maxSessionListCostUsd === undefined || source.maxSessionListCostUsd === null\n    ? 1\n    : Number(source.maxSessionListCostUsd);\n  if (provider === \"claude_managed\" && !managedProfileId) {\n    throw new RouteError(400, \"invalid_managed_profile\", \"Claude Managed requires a qualified profile ID.\");\n  }\n  if (provider === \"claude_managed\" && (!Number.isFinite(maxSessionListCostUsd) || maxSessionListCostUsd <= 0)) {\n    throw new RouteError(400, \"invalid_spend_cap\", \"Claude Managed requires a positive session spend ceiling.\");\n  }\n  const requestedAgentCoreProfileId = source.agentCoreProfileId === undefined || source.agentCoreProfileId === null\n    ? \"default\"\n    : String(source.agentCoreProfileId).trim();\n  const configuredAgentCoreProfileId = process.env.PAPERCLIP_AWS_AGENTCORE_PROFILE_ID?.trim();\n  const agentCoreProfileId = provider === \"aws_agentcore\" && requestedAgentCoreProfileId === \"default\" && configuredAgentCoreProfileId\n    ? configuredAgentCoreProfileId\n    : requestedAgentCoreProfileId;\n  const maxEstimatedSessionCostUsd = source.maxEstimatedSessionCostUsd === undefined || source.maxEstimatedSessionCostUsd === null\n    ? 1\n    : Number(source.maxEstimatedSessionCostUsd);\n  if (provider === \"aws_agentcore\" && !agentCoreProfileId) {\n    throw new RouteError(400, \"invalid_agentcore_profile\", \"AWS AgentCore requires a qualified profile ID.\");\n  }\n  if (provider === \"aws_agentcore\" && (!Number.isFinite(maxEstimatedSessionCostUsd) || maxEstimatedSessionCostUsd <= 0)) {\n    throw new RouteError(400, \"invalid_spend_cap\", \"AWS AgentCore requires a positive session spend ceiling.\");\n  }\n  const suppliedLifecycle = source.lifecyclePolicy && typeof source.lifecyclePolicy === \"object\"","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/paperclipai/paperclip/blob/5716fe907e596ce73501408fc6efdb19fb61edf2/packages/paperclip-runner/scripts/capability-issue-thread-server.mjs#L231-L267","documentation":"Guard in harnessConfiguration: for claude_managed, maxSessionListCostUsd must be a finite positive number; a missing, non-numeric, zero, or negative spend ceiling throws RouteError(400,'invalid_spend_cap'). The ceiling bounds what one managed session may spend listing sessions, so an invalid value cannot be accepted.","triggerScenarios":"Thrown at packages/paperclip-runner/scripts/capability-issue-thread-server.mjs:249 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Send a positive finite maxSessionListCostUsd value in the payload.","Omit maxSessionListCostUsd so the built-in default ceiling applies instead of an explicit invalid one.","Check for string/NaN values leaking from form inputs; coerce to a number before submitting."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}