{"record":{"id":"b497e23877196a09","repo":"musistudio/claude-code-router","slug":"source-item-json-stringify-key-is-m","errorCode":null,"errorMessage":"${source + \" item \" + JSON.stringify(key) + \" is missing.\"}","messagePattern":"\\$\\{source \\+ \" item \" \\+ JSON\\.stringify\\(key\\) \\+ \" is missing\\.\"\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/electron/src/main/provider-account-webcontent.ts","lineNumber":137,"sourceCode":"    credentials: normalizeRequestCredentials(request.credentials),\n    endpoint: request.endpoint,\n    headerTemplates: normalizeHeaderTemplates(request.headerTemplates),\n    headers: normalizeRequestHeaders(request.headers),\n    maxResponseBytes,\n    method: request.method,\n    timeoutMs\n  });\n\n  return `\n    (async () => {\n      const request = ${serializedRequest};\n      const headers = { ...request.headers };\n      const storagePattern = /\\\\$\\\\{(localStorage|sessionStorage)(?:\\\\.([A-Za-z_$][\\\\w$]*)|\\\\[['\"]([^'\"]+)['\"]\\\\])\\\\}/g;\n      const readStorageValue = (source, key) => {\n        const storage = source === \"sessionStorage\" ? sessionStorage : localStorage;\n        const value = storage.getItem(key);\n        if (value === null) {\n          throw new Error(source + \" item \" + JSON.stringify(key) + \" is missing.\");\n        }\n        return value;\n      };\n      const renderHeaderTemplate = (template) => {\n        const rendered = String(template).replace(storagePattern, (_match, source, dotKey, quotedKey) => readStorageValue(source, dotKey || quotedKey));\n        if (rendered.includes(\"\\${localStorage\") || rendered.includes(\"\\${sessionStorage\")) {\n          throw new Error(\"Unsupported browser header template expression.\");\n        }\n        return rendered;\n      };\n      if (request.method === \"POST\" && !Object.keys(headers).some((key) => key.toLowerCase() === \"content-type\")) {\n        headers[\"content-type\"] = \"application/json\";\n      }\n      const controller = new AbortController();\n      const timer = setTimeout(() => controller.abort(), request.timeoutMs);\n      try {\n        for (const [key, template] of Object.entries(request.headerTemplates || {})) {\n          headers[key] = renderHeaderTemplate(template);","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/musistudio/claude-code-router/blob/99f24806c6a2c660b16e53e95211c517448a6c90/packages/electron/src/main/provider-account-webcontent.ts#L119-L155","documentation":"Error \"${source + \" item \" + JSON.stringify(key) + \" is missing.\"}\" thrown in musistudio/claude-code-router.","triggerScenarios":"Thrown at packages/electron/src/main/provider-account-webcontent.ts:137 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"99f24806c6a2c660b16e53e95211c517448a6c90","analyzedAt":"2026-08-27T04:11:01.184Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}