moeru-ai/airi · error · Error
Failed to remove provider
Error message
Failed to remove provider
What it means
Thrown by InferenceServiceProvidersService.deleteRemote when DELETE /v1/providers/:id returns non-ok. Like removeRemote for characters, this does not parse JSON on success; it only checks ok. Message discards the status.
Source
Thrown at packages/stage-ui/src/services/inference-service-providers.ts:175
validated: provider.status === 'configured',
validationBypassed: provider.status === 'bypassed',
},
}, requestOptions(options))
if (!res.ok)
throw new Error('Failed to add provider')
const item = await res.json()
options?.abortSignal?.throwIfAborted()
return normalize(item)
}
async function deleteRemote(client: InferenceServiceProvidersRemoteClient, providerId: string, options?: InferenceServiceProviderServiceOptions): Promise<void> {
options?.abortSignal?.throwIfAborted()
const res = await client.api.v1.providers[':id'].$delete({
param: { id: providerId },
}, requestOptions(options))
if (!res.ok)
throw new Error('Failed to remove provider')
options?.abortSignal?.throwIfAborted()
}
async function patchConfigRemote(
client: InferenceServiceProvidersRemoteClient,
providerId: string,
config: Record<string, unknown>,
status: ProviderValidationStatus,
options?: InferenceServiceProviderServiceOptions,
): Promise<InferenceServiceProvider> {
options?.abortSignal?.throwIfAborted()
const res = await client.api.v1.providers[':id'].$patch({
param: { id: providerId },
json: {
config,
validated: status === 'configured',
validationBypassed: status === 'bypassed',
},View on GitHub (pinned to 27111382b4)
Solutions
- Treat 404 as success if the provider is already gone locally (idempotent delete).
- Re-authenticate on 401/403 before retrying.
- Include res.status to allow 404-tolerant handling upstream.
Example fix
// before
if (!res.ok)
throw new Error('Failed to remove provider')
// after
if (!res.ok && res.status !== 404)
throw new Error(`Failed to remove provider ${providerId} (status ${res.status})`) Defensive patterns
Strategy: try-catch
Validate before calling
// Idempotent delete; only auth and a valid id are needed.
function isValidProviderId(id: string): boolean {
return typeof id === 'string' && id.length > 0
} Try / catch
try {
await deleteRemote(client, providerId)
}
catch (error) {
// Patch service to expose status; tolerate 404 since the provider is already gone.
// On 401/403 re-authenticate and retry once.
throw error
} Prevention
- Treat 404 on delete as success when the provider is already removed locally.
- Embed res.status in the service error so callers can tolerate 404.
- Disable the delete control after the first click to avoid double-delete races.
When it happens
Trigger: client.api.v1.providers[':id'].$delete({ param: { id } }) resolves with ok=false. Typical: 401/403 (not authenticated / not owner), 404 (provider already deleted), 500 (server).
Common situations: Double delete; deleting a provider removed by another client; expired session; permission mismatch.
Related errors
- Failed to fetch character
- Failed to remove character
- Failed to fetch providers
- Failed to add provider
- Failed to update provider config
AI-assisted analysis of moeru-ai/airi@27111382b4 (2026-08-12).
Data as JSON: /api/errors/dec8db727e7d6e2f.
Report an issue: GitHub.