{"record":{"id":"71f36d0441fc6164","repo":"langflow-ai/langflow","slug":"str-exc-71f36d","errorCode":null,"errorMessage":"str(exc)","messagePattern":"str\\(exc\\)","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"src/backend/base/langflow/api/v1/knowledge_bases.py","lineNumber":1273,"sourceCode":"\n        # Build + validate the folder source up-front so invalid\n        # configurations surface as a 4xx response before a background\n        # job is spawned.\n        source_config: dict[str, Any] = {\n            \"path\": payload.path,\n            \"recursive\": payload.recursive,\n        }\n        if payload.extensions is not None:\n            source_config[\"extensions\"] = payload.extensions\n        if per_file_user_metadata:\n            source_config[\"per_file_metadata\"] = per_file_user_metadata\n        source_config = _apply_folder_source_security_settings(source_config)\n\n        folder_source = FolderSource(user_id=current_user.id, source_config=source_config)\n        try:\n            await folder_source.validate_config()\n        except ValueError as exc:\n            raise HTTPException(status_code=400, detail=str(exc)) from exc\n\n        job_service = get_job_service()\n        job_id = uuid.uuid4()\n\n        await job_service.create_job(\n            job_id=job_id,\n            flow_id=job_id,\n            job_type=JobType.INGESTION,\n            asset_id=asset_id,\n            asset_type=\"knowledge_base\",\n            user_id=current_user.id,\n        )\n\n        task_service = get_task_service()\n        await task_service.fire_and_forget_task(\n            job_service.execute_with_status,\n            job_id=job_id,\n            run_coro_func=KBIngestionHelper.perform_ingestion,","sourceCodeStart":1255,"sourceCodeEnd":1291,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/api/v1/knowledge_bases.py#L1255-L1291","documentation":"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).","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"# before\npayload = {\"path\": \"/home/me/data\", \"recursive\": True}\n\n# after (docker: data mounted at /data)\npayload = {\"path\": \"/data\", \"recursive\": True}","handlingStrategy":"validation","validationCode":"import os\n\ndef folder_payload_valid(path: str, allowed_roots: list[str]) -> bool:\n    expanded = os.path.abspath(os.path.expanduser(path))\n    return os.path.isdir(expanded) and any(expanded.startswith(r) for r in allowed_roots)","typeGuard":null,"tryCatchPattern":"try:\n    resp = await client.post(folder_url, json=payload)\nexcept HTTPStatusError as e:\n    if e.response.status_code == 400:\n        surface_error(e.response.json()[\"detail\"])  # FolderSource message names the field","preventionTips":["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."],"tags":["knowledge-base","folder-ingest","validation","http-400"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}