langflow-ai/langflow · error · HTTPException
str(exc)
Error message
str(exc)
What it means
A 400 whose detail is the message of a ValueError raised by FolderSource.validate_config() on the folder-ingest endpoint. Validation happens up-front so invalid folder configurations fail before any background job is spawned. The detail string is produced by the FolderSource implementation (path allow-list, existence, recursion settings, security settings applied via _apply_folder_source_security_settings).
Source
Thrown at src/backend/base/langflow/api/v1/knowledge_bases.py:1273
# Build + validate the folder source up-front so invalid
# configurations surface as a 4xx response before a background
# job is spawned.
source_config: dict[str, Any] = {
"path": payload.path,
"recursive": payload.recursive,
}
if payload.extensions is not None:
source_config["extensions"] = payload.extensions
if per_file_user_metadata:
source_config["per_file_metadata"] = per_file_user_metadata
source_config = _apply_folder_source_security_settings(source_config)
folder_source = FolderSource(user_id=current_user.id, source_config=source_config)
try:
await folder_source.validate_config()
except ValueError as exc:
raise HTTPException(status_code=400, detail=str(exc)) from exc
job_service = get_job_service()
job_id = uuid.uuid4()
await job_service.create_job(
job_id=job_id,
flow_id=job_id,
job_type=JobType.INGESTION,
asset_id=asset_id,
asset_type="knowledge_base",
user_id=current_user.id,
)
task_service = get_task_service()
await task_service.fire_and_forget_task(
job_service.execute_with_status,
job_id=job_id,
run_coro_func=KBIngestionHelper.perform_ingestion,View on GitHub (pinned to 976ec789d2)
Solutions
- Read the returned detail message — it names the exact validation failure (missing path, not a directory, disallowed root).
- Ensure payload.path exists on the server and is readable by the backend process.
- If the operator allow-lists ingest roots, move data under an allowed root or ask the operator to extend the allow-list (then restart).
- For containerized deployments, mount the data directory into the container and use the in-container path.
Example fix
# before
payload = {"path": "/home/me/data", "recursive": True}
# after (docker: data mounted at /data)
payload = {"path": "/data", "recursive": True} Defensive patterns
Strategy: validation
Validate before calling
import os
def folder_payload_valid(path: str, allowed_roots: list[str]) -> bool:
expanded = os.path.abspath(os.path.expanduser(path))
return os.path.isdir(expanded) and any(expanded.startswith(r) for r in allowed_roots) Try / catch
try:
resp = await client.post(folder_url, json=payload)
except HTTPStatusError as e:
if e.response.status_code == 400:
surface_error(e.response.json()["detail"]) # FolderSource message names the field Prevention
- Use absolute server-side paths; remember ~ expands on the server.
- Confirm the path exists inside the operator's allowed ingest roots before sending.
- In containers, mount data volumes and reference the in-container path.
When it happens
Trigger: POST /api/v1/knowledge_bases/{kb_name}/ingest/folder with a payload.path that does not exist, is not a directory, is outside the operator-configured allow-list of ingestible roots, or otherwise fails FolderSource validation (e.g. path denied by server-side security settings).
Common situations: Running the backend in a container so paths like /home/user/data on the host are absent; forgetting that ~ expands to the server's home, not the client's; the operator restricting folder ingestion to specific roots via security settings.
Related errors
- Failed to install MCP
- Invalid path
- Provider '{provider}' is not configured. Available providers
- Could not extract class name from code
- Inputs and outputs have overlapping names: {overlap}
AI-assisted analysis of langflow-ai/langflow@976ec789d2 (2026-08-14).
Data as JSON: /api/errors/71f36d0441fc6164.
Report an issue: GitHub.