{"record":{"id":"8d36d4649c92693e","repo":"musistudio/claude-code-router","slug":"claude-code-global-config-file-is-not-valid-json","errorCode":null,"errorMessage":"Claude Code global config file is not valid JSON: ${file}. ${formatError(error)}","messagePattern":"Claude Code global config file is not valid JSON: (.+?)\\. (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/profiles/service.ts","lineNumber":2204,"sourceCode":"    ...current,\n    autoCompactWindowsCache: createClaudeCliAutoCompactWindows(config)\n  };\n  const writeResult = writeFileWithBackup(file, `${JSON.stringify(next, null, 2)}\\n`, { mode: privateFileMode });\n  return { ...writeResult, file };\n}\n\nfunction readClaudeCodeGlobalConfigObject(file: string): Record<string, unknown> {\n  if (!existsSync(file)) {\n    return {};\n  }\n  try {\n    const parsed = JSON.parse(readFileSync(file, \"utf8\")) as unknown;\n    if (isRecord(parsed)) {\n      return parsed;\n    }\n    throw new Error(\"root value is not an object\");\n  } catch (error) {\n    throw new Error(`Claude Code global config file is not valid JSON: ${file}. ${formatError(error)}`);\n  }\n}\n\nfunction codexMiddlewareRuntimeFilename(): string {\n  return \"ccr-codex-cli-middleware.js\";\n}\n\nfunction codexMiddlewareFilename(profile: ProfileConfig, providerId: string): string {\n  const slug = sanitizeCodexProviderId(profile.id || profile.name || providerId) || \"codex\";\n  return process.platform === \"win32\"\n    ? `ccr-codex-cli-stdio-${slug}.cmd`\n    : `ccr-codex-cli-stdio-${slug}`;\n}\n\nfunction shellProfileSurfaceExports(surface: \"auto\" | \"cli\" | \"app\"): string[] {\n  return [\n    \"if [ -z \\\"${CCR_PROFILE_SURFACE:-}\\\" ]; then\",\n    \"  case \\\"${1:-}\\\" in\",","sourceCodeStart":2186,"sourceCodeEnd":2222,"githubUrl":"https://github.com/musistudio/claude-code-router/blob/99f24806c6a2c660b16e53e95211c517448a6c90/packages/core/src/profiles/service.ts#L2186-L2222","documentation":"Error \"Claude Code global config file is not valid JSON: ${file}. ${formatError(error)}\" thrown in musistudio/claude-code-router.","triggerScenarios":"Thrown at packages/core/src/profiles/service.ts:2204 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"}