lfnovo/open-notebook · warning · HTTPException

Vector search requires an embedding model. Please configure

Error message

Vector search requires an embedding model. Please configure one in the Models section.

What it means

400 raised when a vector search is requested but no embedding model is configured in Open Notebook's model manager. Vector search needs an embedding model to convert the query into a vector.

Source

Thrown at api/routers/search.py:28

from open_notebook.domain.notebook import text_search, vector_search
from open_notebook.exceptions import (
    DatabaseOperationError,
    InvalidInputError,
    OpenNotebookError,
)
from open_notebook.graphs.ask import graph as ask_graph

router = APIRouter()


@router.post("/search", response_model=SearchResponse)
async def search_knowledge_base(search_request: SearchRequest):
    """Search the knowledge base using text or vector search."""
    try:
        if search_request.type == "vector":
            # Check if embedding model is available for vector search
            if not await model_manager.get_embedding_model():
                raise HTTPException(
                    status_code=400,
                    detail="Vector search requires an embedding model. Please configure one in the Models section.",
                )

            results = await vector_search(
                keyword=search_request.query,
                results=search_request.limit,
                source=search_request.search_sources,
                note=search_request.search_notes,
                minimum_score=search_request.minimum_score,
            )
        else:
            # Text search
            results = await text_search(
                keyword=search_request.query,
                results=search_request.limit,
                source=search_request.search_sources,
                note=search_request.search_notes,

View on GitHub (pinned to a7de90d38a)

Solutions

  1. Go to Settings → Models and add/select a default embedding model
  2. Verify the provider credentials (e.g. OpenAI API key) are set and encrypted successfully
  3. Retry the search with type 'text' if embeddings are not needed

Example fix

// before
{"query": "topic", "type": "vector"}
// after
// configure embedding model first, then:
{"query": "topic", "type": "vector"}
Defensive patterns

Strategy: validation

Validate before calling

const embedding = (await fetch('/api/models').json())
  .find(m => m.type === 'embedding' && m.is_default);
if (!embedding) useTextSearch();

Prevention

When it happens

Trigger: POST /api/search with {"type": "vector", ...} when model_manager.get_embedding_model() returns None — i.e. no model of type 'embedding' is marked as default in Settings → Models.

Common situations: Fresh install without model setup, embedding model deleted or disabled, provider API keys missing so the model never became active.

Related errors


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