lfnovo/open-notebook · error · HTTPException

Error auto-assigning defaults: {str(e)}

Error message

Error auto-assigning defaults: {str(e)}

What it means

Generic 500 from the auto-assign defaults endpoint when automatically assigning default models fails. The handler ranks discovered models per provider priority; unexpected exceptions during discovery, ranking, or the defaults update land here.

Source

Thrown at api/routers/models.py:846

                setattr(defaults, slot_name, model_id)

        # Save updated defaults if any assignments were made
        if assigned:
            await defaults.update()

        return AutoAssignResult(
            assigned=assigned,
            skipped=skipped,
            missing=missing,
        )

    except HTTPException:
        raise
    except OpenNotebookError:
        raise
    except Exception as e:
        logger.error(f"Error auto-assigning defaults: {str(e)}")
        raise HTTPException(
            status_code=500, detail=f"Error auto-assigning defaults: {str(e)}"
        )

View on GitHub (pinned to a7de90d38a)

Solutions

  1. Check API logs for 'Error auto-assigning defaults'
  2. Ensure at least one provider is configured with valid credentials
  3. Run discovery/sync manually first (POST /models/sync) to confirm it works
  4. Retry auto-assign after fixing the underlying provider issue
Defensive patterns

Strategy: try-catch

Validate before calling

const avail = await api.getProviderAvailability();
if (!Object.values(avail).some(v => v.available)) throw new Error('configure a provider first');

Try / catch

try { await api.autoAssignDefaults(); } catch (e) { if (e.status === 500) { await syncProviders(); await retryOnce(); } }

Prevention

When it happens

Trigger: POSTing auto-assign when no providers are configured/discoverable, when discovery raises unexpectedly, or when writing defaults fails (DB error).

Common situations: Fresh install with no API keys so discovery returns garbage or throws; DB unavailable; conflicting concurrent defaults update.

Related errors


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