QuantumNous/new-api · warning · Error
Failed to fetch status
Error message
Failed to fetch status
What it means
Thrown by fetchSystemConfig in use-system-config when the raw fetch of /api/status returns a non-2xx HTTP status (response.ok false). This is the pre-login status endpoint that supplies system name, logo, footer, and feature flags, so the whole app shell falls back to defaults when it fails. It is a transport-level failure, before any JSON success flag is evaluated.
Source
Thrown at web/src/hooks/use-system-config.ts:108
data.custom_currency_exchange_rate,
DEFAULT_CURRENCY_CONFIG.customCurrencyExchangeRate
),
}
return {
systemName: data.system_name || DEFAULT_SYSTEM_NAME,
logo: data.logo || DEFAULT_LOGO,
footerHtml: data.footer_html,
demoSiteEnabled: data.demo_site_enabled,
displayTokenStatEnabled: data.display_token_stat_enabled,
currency,
}
}
// Fetch system config from API
async function fetchSystemConfig(): Promise<Partial<SystemConfig>> {
const response = await fetch('/api/status')
if (!response.ok) throw new Error('Failed to fetch status')
const data: StatusApiResponse = await response.json()
if (!data.success) throw new Error('API returned error')
return mapStatusDataToConfig(data.data)
}
// Preload image and return cleanup function
function preloadImage(
src: string,
onLoad: () => void,
onError: () => void
): () => void {
const img = new Image()
img.onload = onLoad
img.onerror = onError
img.src = src
View on GitHub (pinned to e2c7aa7b10)
Solutions
- Open /api/status directly in the browser or curl it and read the HTTP status code.
- If 404/502, fix the proxy config (Rsbuild dev proxy, nginx location /api, or base URL) so the SPA reaches the Go backend.
- If 5xx, check backend logs/health — the status endpoint should be cheap; a 500 usually means startup misconfiguration.
- Retry once on transient failures before falling back to default config values.
Example fix
// before
const response = await fetch('/api/status')
if (!response.ok) throw new Error('Failed to fetch status')
// after — include status for diagnosability
const response = await fetch('/api/status')
if (!response.ok) {
throw new Error(`Failed to fetch status: ${response.status} ${response.statusText}`)
} Defensive patterns
Strategy: retry
Try / catch
try {
await fetchSystemConfig()
} catch (error) {
if (error.message === 'Failed to fetch status') {
// fall back to DEFAULT_SYSTEM_NAME/DEFAULT_LOGO config; retry on next app focus
}
} Prevention
- Verify the /api reverse-proxy rule in every environment before shipping the SPA
- Treat /api/status failures as non-fatal: defaults must fully cover branding and flags
- Add a health check for /api/status in deployment smoke tests
When it happens
Trigger: fetch('/api/status') resolves with a 4xx/5xx/3xx status: backend down, 502/503 from a proxy, 404 when the frontend is served without the /api proxy, 429 under rate limiting.
Common situations: Dev server started without the backend or with a wrong proxy configuration so /api/status 404s; gateway misrouting; backend crash during deploy; CDN serving the SPA while the API origin is unreachable.
Related errors
AI-assisted analysis of QuantumNous/new-api@e2c7aa7b10 (2026-08-15).
Data as JSON: /api/errors/efd46b3357147f57.
Report an issue: GitHub.