langflow-ai/langflow · error · HTTPException

Error ingesting files to knowledge base.

Error message

Error ingesting files to knowledge base.

What it means

Catch-all 500 from the file-upload ingest endpoint: any exception other than an explicit HTTPException while validating, reading files, resolving the asset id, creating the job, or scheduling the ingestion task is logged ('Error ingesting files to knowledge base: %s') and re-raised as this generic detail. The true cause is only visible in server logs.

Source

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

            files_data=files_data,
            chunk_size=chunk_size,
            chunk_overlap=chunk_overlap,
            separator=separator,
            source_name=source_name,
            current_user=current_user,
            model_selection=model_selection,
            task_job_id=job_id,
            job_service=job_service,
            source_metadata=run_metadata or None,
            per_file_metadata=per_file_metadata_dict or None,
        )
        return TaskResponse(id=str(job_id), href=f"/task/{job_id}")

    except HTTPException:
        raise
    except Exception as e:
        await logger.aerror("Error ingesting files to knowledge base: %s", e)
        raise HTTPException(status_code=500, detail="Error ingesting files to knowledge base.") from e


class IngestFolderRequest(BaseModel):
    """Body payload for ``POST /{kb_name}/ingest/folder``.

    Path is expanded (``~`` → user home) and resolved before being
    checked against the settings allow-list. The per-file size limit is
    operator-owned and is not exposed as a request field.
    """

    path: str = Field(..., description="Absolute or ~-expanded directory to walk.")
    recursive: bool = Field(default=True, description="Walk subdirectories as well.")
    extensions: list[str] | None = Field(
        None,
        description="Lowercase extensions without dot. None → defaults (txt, md, pdf, docx, …).",
    )
    source_name: str = Field("", description="Optional grouping label stamped on every chunk's 'source'.")
    chunk_size: int = Field(

View on GitHub (pinned to 976ec789d2)

Solutions

  1. Check the backend logs for the line 'Error ingesting files to knowledge base: <e>' — the logged exception is the real cause; fix that first.
  2. Verify DB availability and that Job/Task tables are reachable (job creation happens before the 500).
  3. Check filesystem permissions and free space on the KB storage directory.
  4. If the underlying exception is a code bug after an upgrade, update to the latest patch release or report with the stack trace.
Defensive patterns

Strategy: retry

Try / catch

try:
    resp = await client.post(upload_url, files=files)
except HTTPStatusError as e:
    if e.response.status_code == 500:
        log_server_error("ingest upload", e)  # correlate with backend log line
        await backoff_retry(upload, attempts=3)

Prevention

When it happens

Trigger: POST /api/v1/knowledge_bases/{kb_name}/upload that passes early validation but fails later — e.g. job service cannot create the job row (DB down), reading the upload stream fails, _resolve_kb_asset_id hits a database error, or file-write/IO errors under the KB directory.

Common situations: Database connectivity issues, disk full or permission problems on the KB storage path, unexpected connector/embedding setup exceptions, or a bug in the ingestion path after a version upgrade.

Related errors


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