paperclipai/paperclip · error · RouteError

invalid_model

invalid_model

Error message

Model is too long.

What it means

Guard in harnessConfiguration of the capability issue-thread HTTP server: the requested runner model string exceeds the 256-character cap, so a RouteError(400,'invalid_model') is thrown before any harness is built. It fires when a client supplies an absurdly long model identifier in the harness configuration payload; the input at fault is source.model.

Source

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

    ],
  });
}

class RouteError extends Error {
  constructor(status, code, message) {
    super(message);
    this.status = status;
    this.code = code;
  }
}

function harnessConfiguration(source, fallbackModel) {
  const provider = source.provider === undefined ? "codex" : String(source.provider).trim();
  if (provider !== "codex" && provider !== "opencode" && provider !== "claude_managed" && provider !== "aws_agentcore" && provider !== "acpx") {
    throw new RouteError(400, "invalid_provider", "Provider must be codex, opencode, claude_managed, aws_agentcore, or acpx.");
  }
  const rawModel = source.model === undefined ? fallbackModel : source.model;
  const model = rawModel === undefined || rawModel === null ? "" : String(rawModel).trim();
  if (model.length > 256) throw new RouteError(400, "invalid_model", "Model is too long.");
  if (provider === "opencode" && (!model || !model.includes("/"))) {
    throw new RouteError(400, "invalid_model", "OpenCode requires a provider/model value.");
  }
  if (provider === "claude_managed" && model !== "claude-sonnet-5") {
    throw new RouteError(400, "invalid_model", "Claude Managed requires exact model claude-sonnet-5.");
  }
  if (provider === "aws_agentcore" && model !== "global.anthropic.claude-sonnet-4-6") {
    throw new RouteError(400, "invalid_model", "AWS AgentCore requires exact model global.anthropic.claude-sonnet-4-6.");
  }
  const acpxAgent = source.acpxAgent === undefined ? "codex" : String(source.acpxAgent).trim();
  if (provider === "acpx") {
    if (!(acpxAgent in ACPX_QUALIFIED_MODELS)) {
      throw new RouteError(400, "invalid_acpx_agent", "ACPX agent must be claude or codex.");
    }
    if (model !== ACPX_QUALIFIED_MODELS[acpxAgent]) {
      throw new RouteError(400, "invalid_model", `The qualified ACPX ${acpxAgent} profile requires exact model ${ACPX_QUALIFIED_MODELS[acpxAgent]}.`);
    }

View on GitHub (pinned to 5716fe907e)

Solutions

  1. Shorten the model identifier to 256 characters or fewer before sending the harness configuration request.
  2. Verify the client is not concatenating or duplicating the model string; send only the model name the target provider expects.
  3. Catch the 400 invalid_provider/invalid_model responses client-side and surface the length constraint to the user.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/paperclip-runner/scripts/capability-issue-thread-server.mjs:215 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/1c7749859857be0d. Report an issue: GitHub.