paperclipai/paperclip · error · RouteError

invalid_spend_cap

invalid_spend_cap

Error message

Claude Managed requires a positive session spend ceiling.

What it means

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.

Source

Thrown at packages/paperclip-runner/scripts/capability-issue-thread-server.mjs:249

    if (model !== ACPX_QUALIFIED_MODELS[acpxAgent]) {
      throw new RouteError(400, "invalid_model", `The qualified ACPX ${acpxAgent} profile requires exact model ${ACPX_QUALIFIED_MODELS[acpxAgent]}.`);
    }
  }
  const requestedManagedProfileId = source.managedProfileId === undefined || source.managedProfileId === null
    ? "default"
    : String(source.managedProfileId).trim();
  const configuredManagedProfileId = process.env.PAPERCLIP_CLAUDE_MANAGED_PROFILE_ID?.trim();
  const managedProfileId = provider === "claude_managed" && requestedManagedProfileId === "default" && configuredManagedProfileId
    ? configuredManagedProfileId
    : requestedManagedProfileId;
  const maxSessionListCostUsd = source.maxSessionListCostUsd === undefined || source.maxSessionListCostUsd === null
    ? 1
    : Number(source.maxSessionListCostUsd);
  if (provider === "claude_managed" && !managedProfileId) {
    throw new RouteError(400, "invalid_managed_profile", "Claude Managed requires a qualified profile ID.");
  }
  if (provider === "claude_managed" && (!Number.isFinite(maxSessionListCostUsd) || maxSessionListCostUsd <= 0)) {
    throw new RouteError(400, "invalid_spend_cap", "Claude Managed requires a positive session spend ceiling.");
  }
  const requestedAgentCoreProfileId = source.agentCoreProfileId === undefined || source.agentCoreProfileId === null
    ? "default"
    : String(source.agentCoreProfileId).trim();
  const configuredAgentCoreProfileId = process.env.PAPERCLIP_AWS_AGENTCORE_PROFILE_ID?.trim();
  const agentCoreProfileId = provider === "aws_agentcore" && requestedAgentCoreProfileId === "default" && configuredAgentCoreProfileId
    ? configuredAgentCoreProfileId
    : requestedAgentCoreProfileId;
  const maxEstimatedSessionCostUsd = source.maxEstimatedSessionCostUsd === undefined || source.maxEstimatedSessionCostUsd === null
    ? 1
    : Number(source.maxEstimatedSessionCostUsd);
  if (provider === "aws_agentcore" && !agentCoreProfileId) {
    throw new RouteError(400, "invalid_agentcore_profile", "AWS AgentCore requires a qualified profile ID.");
  }
  if (provider === "aws_agentcore" && (!Number.isFinite(maxEstimatedSessionCostUsd) || maxEstimatedSessionCostUsd <= 0)) {
    throw new RouteError(400, "invalid_spend_cap", "AWS AgentCore requires a positive session spend ceiling.");
  }
  const suppliedLifecycle = source.lifecyclePolicy && typeof source.lifecyclePolicy === "object"

View on GitHub (pinned to 5716fe907e)

Solutions

  1. Send a positive finite maxSessionListCostUsd value in the payload.
  2. Omit maxSessionListCostUsd so the built-in default ceiling applies instead of an explicit invalid one.
  3. Check for string/NaN values leaking from form inputs; coerce to a number before submitting.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/paperclip-runner/scripts/capability-issue-thread-server.mjs:249 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of paperclipai/paperclip@5716fe907e (2026-09-02). Data as JSON: /api/errors/31a61f2bf965b2cb. Report an issue: GitHub.