lfnovo/open-notebook · error · HTTPException

Error syncing all models: {str(e)}

Error message

Error syncing all models: {str(e)}

What it means

Generic 500 from POST /api/v1/models/sync (all providers) when the aggregate sync operation fails unexpectedly. Individual per-provider failures may be collected, but an unexpected exception in the orchestration or DB write lands here.

Source

Thrown at api/routers/models.py:637

                discovered=discovered,
                new=new,
                existing=existing,
            )
            total_discovered += discovered
            total_new += new

        return AllProvidersSyncResponse(
            results=response_results,
            total_discovered=total_discovered,
            total_new=total_new,
        )
    except HTTPException:
        raise
    except OpenNotebookError:
        raise
    except Exception as e:
        logger.error(f"Error syncing all models: {str(e)}")
        raise HTTPException(
            status_code=500, detail=f"Error syncing all models: {str(e)}"
        )


@router.get("/models/count/{provider}", response_model=ProviderModelCountResponse)
async def get_model_count(provider: str):
    """
    Get count of registered models for a provider, grouped by type.

    Returns counts for each model type (language, embedding,
    speech_to_text, text_to_speech) as well as total count.
    """
    try:
        counts = await get_provider_model_count(provider)
        total = sum(counts.values())
        return ProviderModelCountResponse(
            provider=provider,
            counts=counts,

View on GitHub (pinned to a7de90d38a)

Solutions

  1. Check API logs for 'Error syncing all models'
  2. Run per-provider sync (POST /models/sync/{provider}) to identify the offender
  3. Fix or remove the misconfigured provider and re-run full sync
Defensive patterns

Strategy: fallback

Validate before calling

const avail = await api.getProviderAvailability();
const good = Object.entries(avail).filter(([,v]) => v.available).map(([k]) => k);
if (good.length === 0) throw new Error('no healthy providers');

Try / catch

try { await api.syncAllModels(); } catch (e) { if (e.status === 500) { for (const p of providers) await safeSync(p); } }

Prevention

When it happens

Trigger: POST /models/sync when any configured provider throws during sync and the code path does not isolate it, or when results cannot be persisted to the DB.

Common situations: One bad provider config breaking the whole sync; DB unavailable while writing synced models; missing API keys.

Related errors


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