{"record":{"id":"7adf36c5d2f803d3","repo":"musistudio/claude-code-router","slug":"model-name-is-too-long","errorCode":null,"errorMessage":"Model name is too long.","messagePattern":"Model name is too long\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/contracts/deep-link.ts","lineNumber":513,"sourceCode":"  const protocol = value.trim();\n  if (!providerProtocols.has(protocol as GatewayProviderProtocol)) {\n    throw new Error(`Unsupported provider protocol: ${value}`);\n  }\n  return protocol as GatewayProviderProtocol;\n}\n\nfunction readDeepLinkModels(params: URLSearchParams, payload: Record<string, unknown> | undefined): string[] {\n  const values = [\n    ...params.getAll(\"models\"),\n    ...payloadModels(payload)\n  ];\n  const seen = new Set<string>();\n  const models: string[] = [];\n\n  for (const value of values) {\n    for (const model of splitModelValue(value)) {\n      if (model.length > maxModelLength) {\n        throw new Error(\"Model name is too long.\");\n      }\n      if (seen.has(model)) {\n        continue;\n      }\n      seen.add(model);\n      models.push(model);\n      if (models.length > maxModels) {\n        throw new Error(\"Too many models in provider link.\");\n      }\n    }\n  }\n\n  return models;\n}\n\nfunction payloadModels(payload: Record<string, unknown> | undefined): string[] {\n  if (!payload) {\n    return [];","sourceCodeStart":495,"sourceCodeEnd":531,"githubUrl":"https://github.com/musistudio/claude-code-router/blob/99f24806c6a2c660b16e53e95211c517448a6c90/packages/core/src/contracts/deep-link.ts#L495-L531","documentation":"readDeepLinkModels collects model names from query params and payload, splits combined values, and enforces maxModelLength per individual model name. Any single model string longer than the cap throws 'Model name is too long.' before dedupe.","triggerScenarios":"A models= or payload models entry containing a model identifier longer than maxModelLength — often because a whole comma list wasn't split on the expected delimiter, or a URL fragment got glued onto a model name.","commonSituations":"Passing an unsplit list 'model-a,model-b,...' when the delimiter differs (semicolon, newline); model values containing trailing URL params from bad encoding; copy-paste appending duplicated text.","solutions":["Use the expected delimiter (comma) so values split into individual short names","Trim whitespace/URL artifacts from each model name","Keep model identifiers to real provider model IDs (tens of chars), not descriptions"],"exampleFix":"// before\nmodels=model-a%2Cmodel-b%2C...glued-long-string-without-delimiters\n// after\nmodels=model-a,model-b","handlingStrategy":"validation","validationCode":"const names = rawModels.split(\",\").map(s => s.trim()).filter(Boolean); if (names.some(n => n.length > 200)) return trimModels();","typeGuard":"const allModelsWithinCap = (models: string[], cap = 200) => models.every(m => m.length <= cap);","tryCatchPattern":"try { parseProviderDeepLinkPayload(url); } catch (e) { if (e instanceof Error && e.message === \"Model name is too long.\") return splitAndSanitizeModels(url); throw e; }","preventionTips":["Always comma-separate model lists","Strip URL artifacts and whitespace from each model id"],"tags":["models","validation","input-length","deep-link"],"backgroundTag":"field-length-limit-exceeded","analyzedSha":"99f24806c6a2c660b16e53e95211c517448a6c90","analyzedAt":"2026-08-27T04:11:01.184Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}