lfnovo/open-notebook · error · HTTPException
No embedding model configured. Please configure one in the M
Error message
No embedding model configured. Please configure one in the Models section.
What it means
400 from POST /api/embed when no default embedding model is configured in the Models section. Embedding requires a default embedding model; model_manager.get_embedding_model() returning falsy means none is set, so the request is rejected before any work.
Source
Thrown at api/routers/embedding.py:22
from api.command_service import CommandService
from api.models import EmbedRequest, EmbedResponse
from open_notebook.ai.models import model_manager
from open_notebook.domain.notebook import Note, Source
from open_notebook.exceptions import (
NotFoundError,
OpenNotebookError,
)
router = APIRouter()
@router.post("/embed", response_model=EmbedResponse)
async def embed_content(embed_request: EmbedRequest):
"""Embed content for vector search."""
try:
# Check if embedding model is available
if not await model_manager.get_embedding_model():
raise HTTPException(
status_code=400,
detail="No embedding model configured. Please configure one in the Models section.",
)
item_id = embed_request.item_id
item_type = embed_request.item_type.lower()
# Validate item type
if item_type not in ["source", "note"]:
raise HTTPException(
status_code=400, detail="Item type must be either 'source' or 'note'"
)
# Branch based on processing mode
if embed_request.async_processing:
# ASYNC PATH: Submit command for background processing
logger.info(f"Using async processing for {item_type} {item_id}")
View on GitHub (pinned to a7de90d38a)
Solutions
- Open the Models section in the UI (or GET /api/models) and set a default embedding model
- If no embedding-capable model exists, add one (built-in or via a configured credential) first
- Ensure the embedding model's backing credential is valid (has a working API key)
- Retry the embed request after the default is set
Defensive patterns
Strategy: validation
Validate before calling
const models = await api.listModels();
const hasEmbeddingDefault = models.some(m => m.isDefault && m.type === 'embedding');
if (!hasEmbeddingDefault) throw new Error('Configure a default embedding model first'); Try / catch
try {
await api.embed({ item_id: id, item_type: 'source', async_processing: true });
} catch (e) {
if (e.status === 400 && /embedding model/i.test(e.detail)) promptModelSetup();
throw e;
} Prevention
- Configure a default embedding model as part of first-run setup
- Re-check model defaults after deleting or changing embedding models
When it happens
Trigger: Calling POST /api/embed (e.g. saving a note or triggering vector search) on a fresh install where no embedding model was ever selected, or after the configured embedding model was deleted.
Common situations: Fresh Open Notebook setup where the user skipped the Models configuration step, or removed/changed the default embedding model and stale clients still submit embed requests.
Related errors
- Item type must be either 'source' or 'note'
- Invalid model type. Must be one of: {valid_types}
- {field} is required and cannot be cleared, only reassigned
- Invalid order_by field: '{order_by}'. Allowed fields: {', '.
- Invalid order_by: '{order_by}'. Allowed fields: {', '.join(s
AI-assisted analysis of lfnovo/open-notebook@a7de90d38a (2026-08-27).
Data as JSON: /api/errors/08202eaf1d5586a1.
Report an issue: GitHub.