lfnovo/open-notebook · error · HTTPException

Error checking provider availability: {str(e)}

Error message

Error checking provider availability: {str(e)}

What it means

Generic 500 from GET /api/v1/models/providers when checking provider availability fails unexpectedly. The handler probes each configured provider; unexpected probe errors (missing API keys surfaced as raw exceptions, import failures) end in this branch.

Source

Thrown at api/routers/models.py:524

                    supported_types[provider].append("language")
            else:
                # Standard provider detection
                for model_type, providers in esperanto_available.items():
                    if provider in providers:
                        supported_types[provider].append(model_type)

        return ProviderAvailabilityResponse(
            available=available_providers,
            unavailable=unavailable_providers,
            supported_types=supported_types,
        )
    except HTTPException:
        raise
    except OpenNotebookError:
        raise
    except Exception as e:
        logger.error(f"Error checking provider availability: {str(e)}")
        raise HTTPException(
            status_code=500, detail=f"Error checking provider availability: {str(e)}"
        )


# =============================================================================
# Model Discovery Endpoints
# =============================================================================


@router.get(
    "/models/discover/{provider}", response_model=List[DiscoveredModelResponse]
)
async def discover_models(provider: str):
    """
    Discover available models from a provider without registering them.

    This endpoint queries the provider's API to list available models
    but does not save them to the database. Use the sync endpoint

View on GitHub (pinned to a7de90d38a)

Solutions

  1. Check API logs for 'Error checking provider availability' to identify the failing provider
  2. Ensure required provider API keys/env vars are set
  3. Install optional provider SDKs if the log shows ImportError
  4. Remove or disable misconfigured providers
Defensive patterns

Strategy: fallback

Validate before calling

const cfg = await api.getConfig(); // ensure provider api keys set before probing
if (!cfg?.providerKeys?.length) return { providers: [] };

Try / catch

try { const p = await api.getProviderAvailability(); } catch (e) { if (e.status === 500) return fallbackProvidersList(); }

Prevention

When it happens

Trigger: GET /models/providers with a provider whose SDK is not installed, env vars missing, or a provider client raising a non-domain exception during the availability probe.

Common situations: Missing API key env vars (e.g. OPENAI_API_KEY), uninstalled optional provider packages, network egress blocked so probes throw.

Related errors


AI-assisted analysis of lfnovo/open-notebook@a7de90d38a (2026-08-27). Data as JSON: /api/errors/760399bf68d95fcd. Report an issue: GitHub.