musistudio/claude-code-router · error · Error

${label} is too long.

Error message

${label} is too long.

What it means

boundedString enforces per-field length caps on deep-link/manifest string fields (manifestUrl, name, baseUrl, apiKey, icon, source). Any present field whose length exceeds its maxLength throws `${label} is too long.` — the label names which field (e.g. 'Base URL is too long.').

Source

Thrown at packages/core/src/contracts/deep-link.ts:463

  if (!payload) {
    return undefined;
  }

  for (const name of names) {
    const value = payload[name];
    if (typeof value === "string" && value.trim()) {
      return value.trim();
    }
  }
  return undefined;
}

function boundedString(value: string | undefined, maxLength: number, label: string): string | undefined {
  if (!value) {
    return undefined;
  }
  if (value.length > maxLength) {
    throw new Error(`${label} is too long.`);
  }
  return value;
}

function validateProviderBaseUrl(value: string): void {
  const url = new URL(providerUrlWithDefaultScheme(value));
  if (!["http:", "https:"].includes(url.protocol)) {
    throw new Error("Provider Base URL must use http or https.");
  }
  if (!url.hostname) {
    throw new Error("Provider Base URL is invalid.");
  }
}

function validateManifestUrl(value: string): void {
  const url = new URL(value);
  if (url.protocol !== "https:") {
    throw new Error("Provider manifest URL must use https.");

View on GitHub (pinned to 99f24806c6)

Solutions

  1. Identify the field from the message label and shorten it below its cap
  2. For icons, use a short https URL or omit icon entirely
  3. Generate links/manifests programmatically with length assertions per field

Example fix

// before
{"provider":{"name":"A".repeat(500),"base_url":"https://api.acme.dev/v1"}}
// after
{"provider":{"name":"acme","base_url":"https://api.acme.dev/v1"}}
Defensive patterns

Strategy: validation

Validate before calling

const caps = { name: 64, baseUrl: 2048, apiKey: 4096, icon: 100000 }; for (const [k, max] of Object.entries(caps)) if ((fields[k] ?? "").length > max) return trim(k);

Type guard

const withinCap = (v: string | undefined, max: number) => !v || v.length <= max;

Try / catch

try { parseProviderDeepLinkPayload(url); } catch (e) { if (e instanceof Error && /is too long\./.test(e.message)) return shortenField(e.message); throw e; }

Prevention

When it happens

Trigger: Passing name longer than the name cap, base_url exceeding maxBaseUrlLength, an oversized icon data-URL, or a long api_key in a deep link or manifest.

Common situations: Inline data-URL icons in manifests; JWT-style or sk-... keys that exceed the apiKey cap; copy-paste appending duplicates into a field; generated manifests without length trimming.

Related errors


AI-assisted analysis of musistudio/claude-code-router@99f24806c6 (2026-08-27). Data as JSON: /api/errors/c46d6a402a17d55d. Report an issue: GitHub.