moeru-ai/airi · error · Error
Failed to fetch providers
Error message
Failed to fetch providers
What it means
Thrown by InferenceServiceProvidersService.fetchRemote when GET /v1/providers returns non-ok. The service then maps the returned array into an InferenceServiceProviders record via normalize. Failure aborts before normalization, so the caller receives no providers.
Source
Thrown at packages/stage-ui/src/services/inference-service-providers.ts:136
let status: ProviderValidationStatus = 'unconfigured'
if (item.validated)
status = 'configured'
else if (item.validationBypassed)
status = 'bypassed'
return {
id: item.id,
definitionId: item.definitionId,
config: item.config,
status,
}
}
async function fetchRemote(client: InferenceServiceProvidersRemoteClient, options?: InferenceServiceProviderServiceOptions): Promise<InferenceServiceProviders> {
options?.abortSignal?.throwIfAborted()
const res = await client.api.v1.providers.$get(undefined, requestOptions(options))
if (!res.ok)
throw new Error('Failed to fetch providers')
const data = await res.json() as unknown[]
options?.abortSignal?.throwIfAborted()
const providers: InferenceServiceProviders = {}
for (const item of data) {
const provider = normalize(item)
providers[provider.id] = provider
}
return providers
}
async function createRemote(client: InferenceServiceProvidersRemoteClient, provider: InferenceServiceProvider, options?: InferenceServiceProviderServiceOptions): Promise<InferenceServiceProvider> {
options?.abortSignal?.throwIfAborted()
const res = await client.api.v1.providers.$post({
json: {
id: provider.id,
definitionId: provider.definitionId,View on GitHub (pinned to 27111382b4)
Solutions
- Confirm authentication and JWT validity before calling fetchRemote.
- Verify SERVER_URL points at a backend serving /v1/providers.
- Include res.status in the message for diagnosis.
- On failure, fall back to locally stored providers or show an empty state with retry.
Example fix
// before
if (!res.ok)
throw new Error('Failed to fetch providers')
// after
if (!res.ok)
throw new Error(`Failed to fetch providers (status ${res.status})`) Defensive patterns
Strategy: try-catch
Validate before calling
function isAuthenticated(): boolean {
return !!getAuthToken()
}
if (!isAuthenticated()) {
// redirect to login or return local providers
return {}
}
await fetchRemote(client) Try / catch
try {
return await fetchRemote(client)
}
catch (error) {
// Fall back to locally stored providers or show empty state with retry.
return localProviders
} Prevention
- Confirm authentication and SERVER_URL before calling fetchRemote.
- Patch the service to embed res.status in the message for diagnosis.
- Cache the last successful provider list to degrade gracefully.
When it happens
Trigger: client.api.v1.providers.$get() resolves with ok=false. Typical: 401/403 (not authenticated), 500 (server), network-level failure mapped to non-ok, /v1/providers route not deployed.
Common situations: Logged-out session loading the providers settings page; backend down or misconfigured; wrong SERVER_URL; expired JWT; CORS blocking the response.
Related errors
- Failed to add provider
- Failed to remove provider
- Failed to update provider config
- Failed to fetch characters
- Failed to fetch character
AI-assisted analysis of moeru-ai/airi@27111382b4 (2026-08-12).
Data as JSON: /api/errors/a15c2c3042ba2185.
Report an issue: GitHub.