{"record":{"id":"efae9032e486cc87","repo":"langflow-ai/langflow","slug":"error-listing-knowledge-bases","errorCode":null,"errorMessage":"Error listing knowledge bases.","messagePattern":"Error listing knowledge bases\\.","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"src/backend/base/langflow/api/v1/knowledge_bases.py","lineNumber":1425,"sourceCode":"            }\n            for kb_info in knowledge_bases:\n                try:\n                    kb_uuid = uuid.UUID(kb_info.id)\n                    if kb_uuid in latest_jobs:\n                        job = latest_jobs[kb_uuid]\n                        raw_status = job.status.value if hasattr(job.status, \"value\") else str(job.status)\n                        mapped = job_status_map.get(raw_status)\n                        if mapped:\n                            kb_info.status = mapped\n                        # For \"completed\", keep the file-marker / chunk-count status already set\n                        kb_info.last_job_id = str(job.job_id)\n                except (ValueError, AttributeError):\n                    # If KB ID is not a valid UUID, skip job status update\n                    pass\n\n    except Exception as e:\n        await logger.aerror(\"Error listing knowledge bases: %s\", e)\n        raise HTTPException(status_code=500, detail=\"Error listing knowledge bases.\") from e\n    else:\n        return knowledge_bases\n\n\n@router.get(\"/connectors\", status_code=HTTPStatus.OK)\nasync def list_connectors(_current_user: CurrentActiveUser) -> list[ConnectorCatalogEntry]:\n    \"\"\"Enumerate registered connector sources for the UI picker.\n\n    Declared before the ``GET /{kb_name}`` route so FastAPI matches\n    the literal ``/connectors`` path first rather than treating it\n    as a ``kb_name`` parameter. Skips ``file_upload`` because that\n    path is wired through the dedicated upload modal.\n    \"\"\"\n    entries: list[ConnectorCatalogEntry] = []\n    for source_type in registered_sources():\n        if source_type is SourceType.FILE_UPLOAD:\n            continue\n        try:","sourceCodeStart":1407,"sourceCodeEnd":1443,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/api/v1/knowledge_bases.py#L1407-L1443","documentation":"Catch-all 500 around the list-knowledge-bases handler: any exception while reading knowledge_base rows, falling back to disk scan, computing sizes, or joining job status is logged ('Error listing knowledge bases: <e>') and returned as this generic detail. Per-KB job-status join errors (ValueError/AttributeError on bad UUIDs) are swallowed; only failures that escape the loop reach this handler.","triggerScenarios":"GET /api/v1/knowledge_bases when the database query for KB rows fails, the disk-scan recovery fallback raises (storage misconfiguration), or size/stat calls raise on unreadable directories.","commonSituations":"Database down or schema not migrated, KB storage root deleted or unreadable by the backend user, or a broken KB directory on disk that the scan fallback cannot stat.","solutions":["Read the server log line 'Error listing knowledge bases: <e>' to identify the failing layer (DB vs disk).","Confirm the database is up and migrations are applied (make alembic-upgrade).","Fix permissions/existence of the KB storage root used by KBStorageHelper.","Move or repair malformed KB directories that break the disk scan."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    kbs = (await client.get(\"/api/v1/knowledge_bases\")).json()\nexcept HTTPStatusError as e:\n    if e.response.status_code == 500:\n        show_degraded_ui()  # KB list unavailable; backend log has the cause\n        await check_backend_health()","preventionTips":["Run DB migrations before starting the backend after upgrades.","Keep the KB storage root readable by the backend process.","Add a health check that hits the KB list endpoint so 500s alert early."],"tags":["knowledge-base","list","http-500","server-error"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}