langflow-ai/langflow · error · HTTPException

Knowledge base missing embedding configuration. Please…

Error message

Knowledge base missing embedding configuration. Please create a new KB or reconfigure it.

What it means

A 400 raised by the file-upload ingest endpoint when KBAnalysisHelper.get_metadata(kb_path, fast=False) returns nothing for the target knowledge base directory. It means the KB on disk has no embedding configuration metadata, which can happen for a KB created without an embedding model or one whose metadata file was lost/corrupted. The fast=False call also runs legacy-KB migration/detection before giving up.

Solutions

  1. Recreate the knowledge base from the UI, explicitly selecting an embedding model and provider.
  2. Reconfigure the existing KB (update embedding settings) so a valid metadata payload with model_selection/embedding_model is written to disk.
  3. Inspect the KB directory on the server and confirm the metadata file exists and is valid JSON; restore it from backup if corrupted.
  4. Verify kb_name matches an actually-created KB (GET /api/v1/knowledge_bases) and is not a leftover directory.
Defensive patterns

Strategy: validation

Validate before calling

async def kb_ready_for_ingest(client, kb_name: str) -> bool:
    resp = await client.get(f"/api/v1/knowledge_bases/{kb_name}")
    if resp.status_code != 200:
        return False
    meta = resp.json().get("embedding_config") or {}
    return bool(meta)

Try / catch

try:
    resp = await client.post(upload_url, files=files)
except HTTPError as e:
    if e.response.status_code == 400 and "missing embedding configuration" in e.response.text:
        # recreate/reconfigure KB, then retry once
        ...

Prevention

When it happens

Trigger: POST /api/v1/knowledge_bases/{kb_name}/upload against a KB whose directory contains no readable embedding metadata (missing/corrupted metadata file, or a KB directory created without ever selecting an embedding model). Also possible if kb_name resolves to a directory the metadata reader cannot parse.

Common situations: Using a KB created before embedding config was mandatory, deleting or partially copying the KB folder on disk, failed prior KB creation that left an empty directory, or pointing at a KB name that maps to a stale directory.

Related errors


AI-assisted analysis of langflow-ai/langflow@976ec789d2 (2026-08-14). Data as JSON: /api/errors/5432ad7d3a135913. Report an issue: GitHub.

Appendix: source

Thrown at src/backend/base/langflow/api/v1/knowledge_bases.py:1082

                column_config_parsed = json.loads(column_config)
                if isinstance(column_config_parsed, list):
                    # Update embedding_metadata.json
                    cc_metadata_path = kb_path / "embedding_metadata.json"
                    if cc_metadata_path.exists():
                        existing_meta = json.loads(cc_metadata_path.read_text())
                        existing_meta["column_config"] = column_config_parsed
                        cc_metadata_path.write_text(json.dumps(existing_meta, indent=2))
                    # Write schema.json for text-metric helpers
                    schema_data = [{**col, "data_type": "string"} for col in column_config_parsed]
                    schema_path = kb_path / "schema.json"
                    schema_path.write_text(json.dumps(schema_data, indent=2))
            except (json.JSONDecodeError, TypeError):
                await logger.awarning("Malformed column_config received, using existing schema")

        # Read embedding metadata (Pass fast=False to ensure legacy KBs are migrated/detected)
        metadata = KBAnalysisHelper.get_metadata(kb_path, fast=False)
        if not metadata:
            raise HTTPException(
                status_code=400,
                detail="Knowledge base missing embedding configuration. Please create a new KB or reconfigure it.",
            )

        # ``model_selection`` is the canonical embedding-config payload.
        # Synthesize it from the legacy flat metadata fields when older
        # KBs only carry those (``record_to_metadata_dict`` writes both
        # forms for new KBs, so this branch is mainly for disk-only
        # ones that haven't been backfilled yet).
        model_selection = metadata.get("model_selection") or {
            "name": metadata.get("embedding_model"),
            "provider": metadata.get("embedding_provider"),
        }
        if not model_selection.get("name") or not model_selection.get("provider"):
            raise HTTPException(status_code=400, detail="Invalid embedding configuration")

        # Use ``KnowledgeBaseRecord.id`` (when present) as the Job's
        # ``asset_id`` so the read path can hit the indexed

View on GitHub (pinned to 976ec789d2)