langflow-ai/langflow · error · HTTPException
Error deleting knowledge bases.
Error message
Error deleting knowledge bases.
What it means
Catch-all 500 wrapping the whole bulk-delete knowledge-bases endpoint. Exceptions outside the per-KB loop's handled set (HTTPException, OSError, PermissionError) — e.g. errors building the result dict, guard failures, or service-layer exceptions during setup — are logged as 'Error deleting knowledge bases: <e>' and returned as this 500. Per-KB filesystem errors are already handled inside the loop and do not reach it.
Source
Thrown at src/backend/base/langflow/api/v1/knowledge_bases.py:2260
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:
raise
except Exception as e:
await logger.aerror("Error deleting knowledge bases: %s", e)
raise HTTPException(status_code=500, detail="Error deleting knowledge bases.") from e
else:
return result
@router.post("/{kb_name}/cancel", status_code=HTTPStatus.OK, dependencies=[Depends(_check_memory_base_association)])
async def cancel_ingestion(
kb_name: str,
current_user: CurrentActiveUser,
job_service: Annotated[JobService, Depends(get_job_service)],
task_service: Annotated[TaskService, Depends(get_task_service)],
) -> dict[str, str]:
"""Cancel the ongoing ingestion task for a knowledge base."""
_kb_guard = await _guard_kb_action(current_user=current_user, action=KnowledgeBaseAction.WRITE, kb_name=kb_name)
_assert_kb_not_memory_base(kb_name, _kb_guard.owner_user)
try:
kb_path = _resolve_kb_path(kb_name, _kb_guard.owner_user)
# ``asset_id`` is now sourced from ``KnowledgeBaseRecord.id``View on GitHub (pinned to 976ec789d2)
Solutions
- Check server log 'Error deleting knowledge bases: ...' for the chained cause
- Shrink the batch to isolate which stage fails (listing vs deleting)
- Verify DB health and retry; per-KB errors that reached the loop are reported in 'failed' and can be retried individually
Defensive patterns
Strategy: try-catch
Try / catch
try:
result = await bulk_delete(client, names)
except httpx.HTTPStatusError as e:
if e.response.status_code == 500:
result = await bulk_delete(client, names[:1]) # bisect to find failing stage
raise Prevention
- Keep bulk batches small so a catch-all 500 does not lose per-KB 'failed' diagnostics
- Ensure DB session health before large batches
- Fall back to per-KB DELETE calls — they give structured per-KB errors
When it happens
Trigger: Bulk delete where an unexpected exception escapes before or after the per-KB loop: KB listing/guard calls, DB session errors, or a KB record shape that breaks earlier processing.
Common situations: DB connectivity dropped mid-bulk-operation; very large batch hitting a timeout; inconsistent KB records (null name/path) in the database.
Related errors
- Error cancelling ingestion.
- Error ingesting via connector.
- Error deleting knowledge base.
- Knowledge bases not found: {}
- Failed to download flows: ${response.statusText}
AI-assisted analysis of langflow-ai/langflow@976ec789d2 (2026-08-14).
Data as JSON: /api/errors/f536b5e68ee70187.
Report an issue: GitHub.