{"record":{"id":"44ac245c05619d8a","repo":"langflow-ai/langflow","slug":"error-ingesting-files-to-knowledge-base","errorCode":null,"errorMessage":"Error ingesting files to knowledge base.","messagePattern":"Error ingesting files to knowledge base\\.","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"src/backend/base/langflow/api/v1/knowledge_bases.py","lineNumber":1150,"sourceCode":"            files_data=files_data,\n            chunk_size=chunk_size,\n            chunk_overlap=chunk_overlap,\n            separator=separator,\n            source_name=source_name,\n            current_user=current_user,\n            model_selection=model_selection,\n            task_job_id=job_id,\n            job_service=job_service,\n            source_metadata=run_metadata or None,\n            per_file_metadata=per_file_metadata_dict or None,\n        )\n        return TaskResponse(id=str(job_id), href=f\"/task/{job_id}\")\n\n    except HTTPException:\n        raise\n    except Exception as e:\n        await logger.aerror(\"Error ingesting files to knowledge base: %s\", e)\n        raise HTTPException(status_code=500, detail=\"Error ingesting files to knowledge base.\") from e\n\n\nclass IngestFolderRequest(BaseModel):\n    \"\"\"Body payload for ``POST /{kb_name}/ingest/folder``.\n\n    Path is expanded (``~`` → user home) and resolved before being\n    checked against the settings allow-list. The per-file size limit is\n    operator-owned and is not exposed as a request field.\n    \"\"\"\n\n    path: str = Field(..., description=\"Absolute or ~-expanded directory to walk.\")\n    recursive: bool = Field(default=True, description=\"Walk subdirectories as well.\")\n    extensions: list[str] | None = Field(\n        None,\n        description=\"Lowercase extensions without dot. None → defaults (txt, md, pdf, docx, …).\",\n    )\n    source_name: str = Field(\"\", description=\"Optional grouping label stamped on every chunk's 'source'.\")\n    chunk_size: int = Field(","sourceCodeStart":1132,"sourceCodeEnd":1168,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/api/v1/knowledge_bases.py#L1132-L1168","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the backend logs for the line 'Error ingesting files to knowledge base: <e>' — the logged exception is the real cause; fix that first.","Verify DB availability and that Job/Task tables are reachable (job creation happens before the 500).","Check filesystem permissions and free space on the KB storage directory.","If the underlying exception is a code bug after an upgrade, update to the latest patch release or report with the stack trace."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    resp = await client.post(upload_url, files=files)\nexcept HTTPStatusError as e:\n    if e.response.status_code == 500:\n        log_server_error(\"ingest upload\", e)  # correlate with backend log line\n        await backoff_retry(upload, attempts=3)","preventionTips":["Keep ingestion batches small so a late-stage 500 does not waste a large upload.","Monitor backend logs for 'Error ingesting files to knowledge base' during bulk loads.","Verify DB and storage health before scheduled ingestion runs."],"tags":["knowledge-base","ingestion","http-500","server-error"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}