{"record":{"id":"c46d6a402a17d55d","repo":"musistudio/claude-code-router","slug":"label-is-too-long","errorCode":null,"errorMessage":"${label} is too long.","messagePattern":"(.+?) is too long\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/contracts/deep-link.ts","lineNumber":463,"sourceCode":"  if (!payload) {\n    return undefined;\n  }\n\n  for (const name of names) {\n    const value = payload[name];\n    if (typeof value === \"string\" && value.trim()) {\n      return value.trim();\n    }\n  }\n  return undefined;\n}\n\nfunction boundedString(value: string | undefined, maxLength: number, label: string): string | undefined {\n  if (!value) {\n    return undefined;\n  }\n  if (value.length > maxLength) {\n    throw new Error(`${label} is too long.`);\n  }\n  return value;\n}\n\nfunction validateProviderBaseUrl(value: string): void {\n  const url = new URL(providerUrlWithDefaultScheme(value));\n  if (![\"http:\", \"https:\"].includes(url.protocol)) {\n    throw new Error(\"Provider Base URL must use http or https.\");\n  }\n  if (!url.hostname) {\n    throw new Error(\"Provider Base URL is invalid.\");\n  }\n}\n\nfunction validateManifestUrl(value: string): void {\n  const url = new URL(value);\n  if (url.protocol !== \"https:\") {\n    throw new Error(\"Provider manifest URL must use https.\");","sourceCodeStart":445,"sourceCodeEnd":481,"githubUrl":"https://github.com/musistudio/claude-code-router/blob/99f24806c6a2c660b16e53e95211c517448a6c90/packages/core/src/contracts/deep-link.ts#L445-L481","documentation":"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.').","triggerScenarios":"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.","commonSituations":"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.","solutions":["Identify the field from the message label and shorten it below its cap","For icons, use a short https URL or omit icon entirely","Generate links/manifests programmatically with length assertions per field"],"exampleFix":"// before\n{\"provider\":{\"name\":\"A\".repeat(500),\"base_url\":\"https://api.acme.dev/v1\"}}\n// after\n{\"provider\":{\"name\":\"acme\",\"base_url\":\"https://api.acme.dev/v1\"}}","handlingStrategy":"validation","validationCode":"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);","typeGuard":"const withinCap = (v: string | undefined, max: number) => !v || v.length <= max;","tryCatchPattern":"try { parseProviderDeepLinkPayload(url); } catch (e) { if (e instanceof Error && /is too long\\./.test(e.message)) return shortenField(e.message); throw e; }","preventionTips":["Assert field lengths in link/manifest generators","Use hosted https icons instead of inline data URLs"],"tags":["validation","input-length","deep-link","manifest"],"backgroundTag":"field-length-limit-exceeded","analyzedSha":"99f24806c6a2c660b16e53e95211c517448a6c90","analyzedAt":"2026-08-27T04:11:01.184Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}