{"record":{"id":"936f355e0b22c345","repo":"langflow-ai/langflow","slug":"knowledge-bases-not-found","errorCode":null,"errorMessage":"Knowledge bases not found: {}","messagePattern":"Knowledge bases not found: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"warning","filePath":"src/backend/base/langflow/api/v1/knowledge_bases.py","lineNumber":2238,"sourceCode":"                    continue\n\n                if not KBStorageHelper.delete_storage(kb_path, kb_name):\n                    # Both rmtree and the sentinel write failed -- count\n                    # this as deleted (the row is gone, the listing UI\n                    # will not show the KB) but warn so the operator can\n                    # follow up on the orphaned bytes.\n                    remote_warnings.append(\n                        f\"Knowledge base '{kb_name}' was removed from the database but its on-disk \"\n                        \"files could not be cleaned up; bytes will be reaped on next server restart.\"\n                    )\n                deleted_count += 1\n            except (HTTPException, OSError, PermissionError) as e:\n                await logger.aexception(\"Error deleting knowledge base '%s': %s\", kb_name, e)\n                # Continue with other deletions even if one fails\n                failed_kbs.append(kb_name)\n\n        if not_found_kbs and deleted_count == 0 and not memory_base_kbs:\n            raise HTTPException(\n                status_code=404, detail=\"Knowledge bases not found: {}\".format(\", \".join(not_found_kbs))\n            )\n\n        result: dict[str, object] = {\n            \"message\": f\"Successfully deleted {deleted_count} knowledge base(s)\",\n            \"deleted_count\": deleted_count,\n        }\n\n        if not_found_kbs:\n            result[\"not_found\"] = \", \".join(not_found_kbs)\n        if failed_kbs:\n            result[\"failed\"] = \", \".join(failed_kbs)\n        if memory_base_kbs:\n            result[\"memory_base_skipped\"] = \", \".join(memory_base_kbs)\n        if remote_warnings:\n            result[\"warnings\"] = remote_warnings\n\n    except HTTPException:","sourceCodeStart":2220,"sourceCodeEnd":2256,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/api/v1/knowledge_bases.py#L2220-L2256","documentation":"404 from the bulk-delete endpoint (DELETE on a collection of knowledge bases). It is raised only when every requested KB was not found (not_found_kbs non-empty), zero were deleted, and none were skipped as memory-base KBs. Individual per-KB failures do NOT trigger it — those are collected in the 'failed' result field — and partial success returns 200 with a breakdown.","triggerScenarios":"Bulk delete request where every name in the list is unknown to the current user: typos, already-deleted KBs, KBs owned by another user, or wrong account.","commonSituations":"Re-running a bulk delete after it already completed; stale frontend state listing KBs deleted elsewhere; case-mismatched KB names.","solutions":["GET /api/v1/knowledge_bases and diff the requested names against what actually exists for your user","Correct typos / casing in the KB names and re-submit only the remaining ones","Treat a repeat 404 as success if the KBs were already deleted"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"existing = {k[\"name\"] for k in (await client.get(\"/api/v1/knowledge_bases\")).json()}\nto_delete = [name for name in requested if name in existing]\nassert to_delete, \"no requested KB exists for this user\"","typeGuard":null,"tryCatchPattern":"try:\n    result = await bulk_delete(client, names)\nexcept httpx.HTTPStatusError as e:\n    if e.response.status_code == 404:\n        names = await refresh_kb_names(client)  # stale list; re-sync and retry\n        result = await bulk_delete(client, names)\n    else:\n        raise","preventionTips":["Diff the requested names against GET /knowledge_bases before bulk delete","Refresh the KB list right before the bulk action in the UI","Handle partial results: check 'not_found'/'failed' fields in 200 responses too"],"tags":["knowledge-base","bulk-delete","http-404","langflow"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}