{"record":{"id":"3ab332aeeb94f300","repo":"paperclipai/paperclip","slug":"max-session-list-cost-usd-must-resolve-to-at-lea","errorCode":null,"errorMessage":"--max-session-list-cost-usd must resolve to at least one cent","messagePattern":"--max-session-list-cost-usd must resolve to at least one cent","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/commands/managed-agent.ts","lineNumber":99,"sourceCode":"  const model = required(options.model, \"--model\");\n  if (model !== CLAUDE_MANAGED_QUALIFIED_MODEL) {\n    throw new Error(\n      `--model must be the qualified Managed Agents model ${CLAUDE_MANAGED_QUALIFIED_MODEL}`,\n    );\n  }\n  if (!UUID_RE.test(apiKeySecretId)) {\n    throw new Error(\"--api-key-secret-id must be a UUID\");\n  }\n\n  const defaultMaxListCostUsd = Number(options.maxSessionListCostUsd);\n  const cents = Math.round(defaultMaxListCostUsd * 100);\n  if (\n    !Number.isFinite(defaultMaxListCostUsd)\n    || defaultMaxListCostUsd <= 0\n    || !Number.isSafeInteger(cents)\n    || cents <= 0\n  ) {\n    throw new Error(\"--max-session-list-cost-usd must resolve to at least one cent\");\n  }\n\n  return {\n    anthropicApiKey,\n    profileKey,\n    displayName,\n    apiKeySecretId,\n    model,\n    agentId: options.agentId?.trim() || undefined,\n    agentVersion: options.agentVersion?.trim() || undefined,\n    environmentId: options.environmentId?.trim() || undefined,\n    defaultMaxListCostUsd,\n  };\n}\n\nasync function anthropicRequest(\n  key: string,\n  method: \"GET\" | \"POST\",","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/paperclipai/paperclip/blob/5716fe907e596ce73501408fc6efdb19fb61edf2/cli/src/commands/managed-agent.ts#L81-L117","documentation":"`--max-session-list-cost-usd` must parse to a finite number greater than zero whose USD value rounds to at least one safe-integer cent. `validateManagedAgentSetup` throws this for values like 0, negative numbers, non-numeric strings, Infinity/NaN, or sub-cent amounts that round to 0. This cap guards against unbounded list-cost spend on Managed Agents sessions.","triggerScenarios":"Passing `--max-session-list-cost-usd 0`, `abc`, `-5`, `0.001` (rounds to 0 cents), or an empty value; locale-formatted numbers like \"1,50\" that Number() cannot parse; passing a value with a currency symbol.","commonSituations":"Env-var-driven config where the variable is unset and becomes \"undefined\"; decimal-comma locales; YAML/JSON configs exporting the limit as a string with units (\"$5\"); typos like 0.004 intending \"small but nonzero\".","solutions":["Pass a plain decimal ≥ 0.01, e.g. --max-session-list-cost-usd 5.00","Remove currency symbols, commas, and units from the value","Check the shell/config variable actually contains a numeric value before invoking","If you genuinely need a sub-cent cap, it is not allowed — the minimum is one cent"],"exampleFix":"// before\n--max-session-list-cost-usd \"$MAX_COST\"   # MAX_COST=\"\"\n// after\nMAX_COST=\"5.00\"\n--max-session-list-cost-usd \"$MAX_COST\"","handlingStrategy":"validation","validationCode":"const cost = Number(maxSessionListCostUsd);\nconst cents = Math.round(cost * 100);\nif (!Number.isFinite(cost) || cost <= 0 || !Number.isSafeInteger(cents) || cents <= 0) {\n  throw new Error(`max-session-list-cost-usd must be a decimal ≥ 0.01 (got \"${maxSessionListCostUsd}\")`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await setupManagedAgent(opts);\n} catch (err) {\n  if (err instanceof Error && err.message.includes(\"at least one cent\")) {\n    console.error(\"Provide a plain numeric USD amount ≥ 0.01, e.g. 5.00\"); process.exitCode = 2;\n  } else throw err;\n}","preventionTips":["Pass plain decimal numbers without currency symbols, commas, or units","Ensure config/env variables feeding the flag are set and numeric","Mirror the cents-rounding check in wrapper scripts to fail before invoking the CLI","Use a locale-independent string format (dot decimal separator)"],"tags":["cli","validation","number-parsing","cost-limit"],"backgroundTag":"invalid-number-input","analyzedSha":"5716fe907e596ce73501408fc6efdb19fb61edf2","analyzedAt":"2026-09-02T18:44:00.616Z","contentChangedAt":"2026-09-02T18:44:00.616Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}