langflow-ai/langflow · warning · HTTPException

Knowledge bases not found: {}

Error message

Knowledge bases not found: {}

What it means

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.

Source

Thrown at src/backend/base/langflow/api/v1/knowledge_bases.py:2238

                    continue

                if not KBStorageHelper.delete_storage(kb_path, kb_name):
                    # Both rmtree and the sentinel write failed -- count
                    # this as deleted (the row is gone, the listing UI
                    # will not show the KB) but warn so the operator can
                    # follow up on the orphaned bytes.
                    remote_warnings.append(
                        f"Knowledge base '{kb_name}' was removed from the database but its on-disk "
                        "files could not be cleaned up; bytes will be reaped on next server restart."
                    )
                deleted_count += 1
            except (HTTPException, OSError, PermissionError) as e:
                await logger.aexception("Error deleting knowledge base '%s': %s", kb_name, e)
                # Continue with other deletions even if one fails
                failed_kbs.append(kb_name)

        if not_found_kbs and deleted_count == 0 and not memory_base_kbs:
            raise HTTPException(
                status_code=404, detail="Knowledge bases not found: {}".format(", ".join(not_found_kbs))
            )

        result: dict[str, object] = {
            "message": f"Successfully deleted {deleted_count} knowledge base(s)",
            "deleted_count": deleted_count,
        }

        if not_found_kbs:
            result["not_found"] = ", ".join(not_found_kbs)
        if failed_kbs:
            result["failed"] = ", ".join(failed_kbs)
        if memory_base_kbs:
            result["memory_base_skipped"] = ", ".join(memory_base_kbs)
        if remote_warnings:
            result["warnings"] = remote_warnings

    except HTTPException:

View on GitHub (pinned to 976ec789d2)

Solutions

  1. GET /api/v1/knowledge_bases and diff the requested names against what actually exists for your user
  2. Correct typos / casing in the KB names and re-submit only the remaining ones
  3. Treat a repeat 404 as success if the KBs were already deleted
Defensive patterns

Strategy: validation

Validate before calling

existing = {k["name"] for k in (await client.get("/api/v1/knowledge_bases")).json()}
to_delete = [name for name in requested if name in existing]
assert to_delete, "no requested KB exists for this user"

Try / catch

try:
    result = await bulk_delete(client, names)
except httpx.HTTPStatusError as e:
    if e.response.status_code == 404:
        names = await refresh_kb_names(client)  # stale list; re-sync and retry
        result = await bulk_delete(client, names)
    else:
        raise

Prevention

When it happens

Trigger: 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.

Common situations: Re-running a bulk delete after it already completed; stale frontend state listing KBs deleted elsewhere; case-mismatched KB names.

Related errors


AI-assisted analysis of langflow-ai/langflow@976ec789d2 (2026-08-14). Data as JSON: /api/errors/936f355e0b22c345. Report an issue: GitHub.