{"record":{"id":"925934e4972d3a44","repo":"lfnovo/open-notebook","slug":"vector-search-requires-an-embedding-model-please","errorCode":null,"errorMessage":"Vector search requires an embedding model. Please configure one in the Models section.","messagePattern":"Vector search requires an embedding model\\. Please configure one in the Models section\\.","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"warning","filePath":"api/routers/search.py","lineNumber":28,"sourceCode":"from open_notebook.domain.notebook import text_search, vector_search\nfrom open_notebook.exceptions import (\n    DatabaseOperationError,\n    InvalidInputError,\n    OpenNotebookError,\n)\nfrom open_notebook.graphs.ask import graph as ask_graph\n\nrouter = APIRouter()\n\n\n@router.post(\"/search\", response_model=SearchResponse)\nasync def search_knowledge_base(search_request: SearchRequest):\n    \"\"\"Search the knowledge base using text or vector search.\"\"\"\n    try:\n        if search_request.type == \"vector\":\n            # Check if embedding model is available for vector search\n            if not await model_manager.get_embedding_model():\n                raise HTTPException(\n                    status_code=400,\n                    detail=\"Vector search requires an embedding model. Please configure one in the Models section.\",\n                )\n\n            results = await vector_search(\n                keyword=search_request.query,\n                results=search_request.limit,\n                source=search_request.search_sources,\n                note=search_request.search_notes,\n                minimum_score=search_request.minimum_score,\n            )\n        else:\n            # Text search\n            results = await text_search(\n                keyword=search_request.query,\n                results=search_request.limit,\n                source=search_request.search_sources,\n                note=search_request.search_notes,","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/lfnovo/open-notebook/blob/a7de90d38aaf18ee85fd661854d35c11e44613e2/api/routers/search.py#L10-L46","documentation":"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.","triggerScenarios":"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.","commonSituations":"Fresh install without model setup, embedding model deleted or disabled, provider API keys missing so the model never became active.","solutions":["Go to Settings → Models and add/select a default embedding model","Verify the provider credentials (e.g. OpenAI API key) are set and encrypted successfully","Retry the search with type 'text' if embeddings are not needed"],"exampleFix":"// before\n{\"query\": \"topic\", \"type\": \"vector\"}\n// after\n// configure embedding model first, then:\n{\"query\": \"topic\", \"type\": \"vector\"}","handlingStrategy":"validation","validationCode":"const embedding = (await fetch('/api/models').json())\n  .find(m => m.type === 'embedding' && m.is_default);\nif (!embedding) useTextSearch();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check for a default embedding model on app startup and prompt configuration","Fall back to text search when embeddings are unavailable"],"tags":["vector-search","embedding-model","configuration","http-400"],"backgroundTag":"missing-model-configuration","analyzedSha":"a7de90d38aaf18ee85fd661854d35c11e44613e2","analyzedAt":"2026-08-27T02:39:58.166Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}