{"record":{"id":"dba5250859284af8","repo":"diegosouzapw/OmniRoute","slug":"failed-to-fetch-github-usage-error-message","errorCode":null,"errorMessage":"Failed to fetch GitHub usage: ${error.message}","messagePattern":"Failed to fetch GitHub usage: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/lib/usage/fetcher.ts","lineNumber":121,"sourceCode":"        resetDate: data.limited_user_reset_date,\n        quotas: {\n          chat: {\n            used: usedQuotas.chat || 0,\n            total: monthlyQuotas.chat || 0,\n            unlimited: false,\n          },\n          completions: {\n            used: usedQuotas.completions || 0,\n            total: monthlyQuotas.completions || 0,\n            unlimited: false,\n          },\n        },\n      };\n    }\n\n    return { message: \"GitHub Copilot connected. Unable to parse quota data.\" };\n  } catch (error) {\n    throw new Error(`Failed to fetch GitHub usage: ${error.message}`);\n  }\n}\n\nfunction formatGitHubQuotaSnapshot(quota) {\n  if (!quota) return { used: 0, total: 0, unlimited: true };\n\n  return {\n    used: quota.entitlement - quota.remaining,\n    total: quota.entitlement,\n    remaining: quota.remaining,\n    unlimited: quota.unlimited || false,\n  };\n}\n\n/**\n * Proactive credit balance probe for Antigravity.\n *\n * Fires a minimal streamGenerateContent request with GOOGLE_ONE_AI credits enabled","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/usage/fetcher.ts#L103-L139","documentation":"Catch-all rethrow in getGitHubUsage: an exception occurred anywhere in the try block (fetch throw, JSON parse, quota field access) and the original error.message is embedded verbatim. This is the terminal wrap for any unexpected failure while fetching/parsing GitHub Copilot quota data.","triggerScenarios":"Thrown at src/lib/usage/fetcher.ts:121 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the embedded error.message to identify the failing stage","Retry for transient network errors","Re-authenticate if the inner message indicates an auth failure"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}