Skip to content

[Bug]: /api/provider-quotas fails as a whole when a single vendor quota probe throws (OpenRouter ECONNRESET, DeepSeek ENOTFOUND) #8939

Closed

Description

@reisen-ww

Client or integration

OpenCodex dashboard

Area

Provider adapter

Summary

GET /api/provider-quotas fails as a whole whenever one vendor's quota probe throws a network error. A DNS/connection error raised inside a single provider probe is not isolated per provider, so the dashboard loses the entire quota report instead of showing the providers it could read.

Observed twice on this machine:

  • 2026-11-19: fetchOpenRouterQuota → ECONNRESET on https://openrouter.ai/api/v1/key
  • 2026-11-08: fetchDeepSeekQuota → getaddrinfo ENOTFOUND api.deepseek.com

In both cases the raw TypeError reaches the request handler and the request ends with GET - http://127.0.0.1:10100/api/provider-quotas failed.

Expected: a failing probe is contained. The provider should be reported as error/unknown (or omitted) and the endpoint should still return 200 with the reports it could collect, the same way provider model discovery already degrades (fallback=stale / fallback=configured) instead of failing the catalog.

Reproduction

  1. Have a provider configured whose quota probe hits an unreachable or resetting host, e.g. an OpenRouter key on a network where openrouter.ai resets the TLS connection, or a DeepSeek key without DNS resolution for api.deepseek.com.

  2. Open the dashboard (it polls the quota endpoint) or call it directly with the admin token:

    curl -H "Authorization: Bearer <admin-api-token>" http://127.0.0.1:10100/api/provider-quotas
    
  3. The request fails and %USERPROFILE%\.opencodex\service.log gets the stack trace below, once per poll.

Expected: HTTP 200 with the remaining providers and a per-provider failure marker.
Actual: request failure for the whole endpoint whenever the reset happens.

Version

2.100.3 (npm runtime); also observed on 2.100.5 after upgrading. Stack line numbers from the npm package at those versions.

Operating system

Windows 11 Pro, build 26200, x64

Provider and model

openrouter (quota probe /key); deepseek (quota probe /user/balance)

Logs or error output

377 | async function fetchOpenRouterQuota(provider: string, config: OcxProviderConfig): Promise<ProviderQuotaProbeResult> {
378 |   // Never send a configured API key to a lookalike host or through a redirect.
379 |   if (!isCanonicalOpenRouterBaseUrl(config.baseUrl)) return null;
380 |   const apiKey = resolveProviderApiKey(config.apiKey)?.trim();
381 |   if (!apiKey) return null;
382 |   const response = await quotaFetch(provider, config, `${OPENROUTER_BASE_URL}/key`, {
                               ^
TypeError: ECONNRESET: The socket connection was closed unexpectedly. For more information, pass `verbose: true` in the second argument to fetch()
  path: "https://openrouter.ai/api/v1/key",
 errno: 0,
  code: "ECONNRESET"

      at async fetchOpenRouterQuota (...\src\providers\quota\vendor-probes-key.ts:382:26)
      at async collectOwnedReport (...\src\providers\quota\report-cache.ts:36:24)
GET - http://127.0.0.1:10100/api/provider-quotas failed
352 | async function fetchDeepSeekQuota(provider: string, config: OcxProviderConfig): Promise<ProviderQuotaProbeResult> {
356 |   const response = await quotaFetch(provider, config, `${DEEPSEEK_BASE_URL}/user/balance`, {
                               ^
TypeError: getaddrinfo ENOTFOUND api.deepseek.com
     path: "https://api.deepseek.com/user/balance",
  syscall: "getaddrinfo",
 hostname: "api.deepseek.com",
    errno: 4,
     code: "ENOTFOUND"

      at async fetchDeepSeekQuota (...\src\providers\quota\vendor-probes-key.ts:356:26)
GET - http://127.0.0.1:10100/api/provider-quotas failed

254 of these accumulated in the log on 2026-11-08 alone, i.e. every dashboard poll fails while the provider stays unreachable.

Screenshots and supporting files

None.

Redacted configuration

Not needed; the failure is the probe's own network error.

Checks

Activity

  1. added
    bug
    account-pool
    provider
    proxy
    on Nov 19, 2026
  2. lidge-jun commented on Nov 20, 2026

    @lidge-jun
    Owner

    Fixed by #8948, squash-merged into dev as d9120df.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    account-poolbugproviderproxy

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions