{"record":{"id":"fd1b1af21e814786","repo":"HKUDS/DeepTutor","slug":"no-embedding-model-is-configured-set-up-the-embed","errorCode":null,"errorMessage":"No embedding model is configured. Set up the embedding profile in Settings before re-indexing.","messagePattern":"No embedding model is configured\\. Set up the embedding profile in Settings before re-indexing\\.","errorType":"http","errorClass":"HTTPException","httpStatus":409,"severity":"error","filePath":"deeptutor/api/routers/knowledge.py","lineNumber":2948,"sourceCode":"        kb_entry = _load_kb_entry_or_404(manager, kb_name)\n        _assert_not_connected_kb(kb_name, kb_entry)\n        force_reindex = str(kb_entry.get(\"status\") or \"\").lower() == \"error\"\n        kb_provider = _validate_registered_provider(\n            kb_entry.get(\"rag_provider\") or DEFAULT_PROVIDER\n        )\n        _assert_provider_ready(kb_provider)\n\n        kb_dir = kb_base_dir / kb_name\n        signature_hash = kb_provider\n        if provider_uses_embedding_versions(kb_provider):\n            from deeptutor.services.rag.embedding_signature import signature_from_embedding_config\n            from deeptutor.services.rag.index_versioning import (\n                find_matching_version,\n            )\n\n            signature = signature_from_embedding_config()\n            if signature is None:\n                raise HTTPException(\n                    status_code=409,\n                    detail=(\n                        \"No embedding model is configured. Set up the embedding \"\n                        \"profile in Settings before re-indexing.\"\n                    ),\n                )\n\n            signature_hash = signature.hash()\n            matching_version = find_matching_version(kb_dir, signature)\n            matching_valid = _matching_index_is_valid(kb_name, matching_version)\n            if (\n                matching_version\n                and matching_version.get(\"layout\") == \"flat\"\n                and matching_valid\n                and not force_reindex\n            ):\n                return {\n                    \"message\": (","sourceCodeStart":2930,"sourceCodeEnd":2966,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/api/routers/knowledge.py#L2930-L2966","documentation":"Thrown (HTTP 409) by the re-index endpoint when signature_from_embedding_config() returns None, meaning no embedding model/profile is configured in runtime settings. The API refuses to rebuild an index because it cannot compute an index-version signature without knowing which embeddings to use.","triggerScenarios":"POST to a KB re-index / recovery endpoint (e.g. /api/knowledge/{kb}/reindex) when data/user/settings has no embedding profile configured, or the configured embedding provider env keys (API key/model) are missing so the config resolves to None.","commonSituations":"Fresh install before first-run setup; switching embedding providers and clearing the old profile; settings JSON deleted or reset; environment variables for the embedding provider not set in the process running the API server.","solutions":["Configure the embedding profile in Settings (UI) or data/user/settings/*.json so an embedding model is set","Verify required env vars/API keys for the embedding provider are visible to the server process","Confirm signature_from_embedding_config() no longer returns None (log it) before retrying re-index","Re-run the re-index request after configuration is saved"],"exampleFix":"// before\nPOST /api/v1/knowledge/my-kb/reindex  -> 409 No embedding model is configured\n// after\n# settings: embedding.profile = {provider: \"openai\", model: \"text-embedding-3-small\", api_key: set}\nPOST /api/v1/knowledge/my-kb/reindex  -> 202","handlingStrategy":"validation","validationCode":"resp = client.get('/api/v1/settings/embedding-profile')\nif not resp.json().get('model'):\n    raise RuntimeError('Configure embedding profile before re-indexing')","typeGuard":null,"tryCatchPattern":"try:\n    client.post(f'/api/v1/knowledge/{kb}/reindex')\nexcept HTTPError as e:\n    if e.response.status_code == 409 and 'embedding model' in e.response.text:\n        configure_embedding_profile(); retry once\n    else: raise","preventionTips":["Complete embedding setup during first-run onboarding","Block the Re-index button in the UI until an embedding profile exists","Health-check signature_from_embedding_config() at server startup and warn"],"tags":["embedding","rag","configuration","http-409","knowledge-base"],"backgroundTag":"missing-configuration","analyzedSha":"3e82f130422a813cdd73c10b21a44e9325f5821a","analyzedAt":"2026-08-27T06:57:25.364Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}