{"record":{"id":"81905eb5c6e542a3","repo":"musistudio/claude-code-router","slug":"grok-cli-oidc-discovery-timed-out-after-timeoutm","errorCode":null,"errorMessage":"Grok CLI OIDC discovery timed out after ${timeoutMs}ms.","messagePattern":"Grok CLI OIDC discovery timed out after (.+?)ms\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/agents/local-providers/grok.ts","lineNumber":758,"sourceCode":"  const timer = setTimeout(() => controller.abort(), timeoutMs);\n  try {\n    const response = await fetchWithSystemProxy(metadataUrl, {\n      headers: { accept: \"application/json\" },\n      signal: controller.signal\n    });\n    const text = await response.text();\n    const payload = parseJsonRecord(text);\n    if (!response.ok) {\n      throw new Error(`Grok CLI OIDC discovery returned HTTP ${response.status}${tokenRefreshErrorMessage(payload, text)}`);\n    }\n    const tokenEndpoint = readString(payload?.token_endpoint) || readString(payload?.tokenEndpoint);\n    if (!tokenEndpoint) {\n      throw new Error(\"Grok CLI OIDC discovery did not return a token endpoint.\");\n    }\n    return tokenEndpoint;\n  } catch (error) {\n    if (error instanceof Error && error.name === \"AbortError\") {\n      throw new Error(`Grok CLI OIDC discovery timed out after ${timeoutMs}ms.`);\n    }\n    throw error;\n  } finally {\n    clearTimeout(timer);\n  }\n}\n\nfunction grokCredentialFiles(): string[] {\n  const explicitFile = process.env.GROK_AUTH_FILE?.trim();\n  return uniqueStrings([\n    explicitFile,\n    path.join(grokStorageRoot(), \"auth.json\"),\n    path.join(grokStorageRoot(), \"credentials.json\")\n  ]);\n}\n\nfunction grokConfigFiles(): string[] {\n  const explicitFile = process.env.GROK_CONFIG_FILE?.trim();","sourceCodeStart":740,"sourceCodeEnd":776,"githubUrl":"https://github.com/musistudio/claude-code-router/blob/99f24806c6a2c660b16e53e95211c517448a6c90/packages/core/src/agents/local-providers/grok.ts#L740-L776","documentation":"The OIDC discovery fetch for Grok was aborted by its internal timeout timer, and the AbortError was converted to a descriptive timeout message. Discovery never completed, so no token endpoint is returned.","triggerScenarios":"The discovery HTTP request or body read exceeds timeoutMs, the AbortController fires, and the catch block rewrites the AbortError into this error.","commonSituations":"Blocked or degraded network paths to the discovery host, DNS resolution hangs, VPN split-tunnel misconfiguration, or provider-side slowness during incidents.","solutions":["Retry the operation","Verify the discovery host resolves and responds (curl with timing)","Disable/bypass proxy or VPN for the OAuth/discovery host","Increase effective network reliability or check firewall rules"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (e) {\n  if (e instanceof Error && e.message.includes('OIDC discovery timed out')) {\n    await retryWithBackoff();\n  }\n}","preventionTips":["Cache discovery results so timeouts only matter on cold start","Retry discovery a bounded number of times before disabling the provider"],"tags":["timeout","oidc","discovery","grok","network"],"backgroundTag":"http-request-timeout","analyzedSha":"99f24806c6a2c660b16e53e95211c517448a6c90","analyzedAt":"2026-08-27T04:11:01.184Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}