langflow-ai/langflow · error · HTTPException

Error cancelling ingestion.

Error message

Error cancelling ingestion.

What it means

Catch-all 500 from POST /api/v1/knowledge_bases/{kb_name}/cancel. Exceptions raised during task revocation, job-status update, or partial-chunk cleanup (the endpoint forwards the KB backend + user_id so remote stores clean up correctly) are logged as 'Error cancelling ingestion: <e>' and become this 500. asyncio.CancelledError and HTTPExceptions are re-raised untouched, so this is genuinely unexpected infrastructure failure.

Source

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

            job.job_id,
            kb_path,
            kb_name,
            backend_type=backend_type_value,
            backend_config=backend_config,
            user_id=current_user.id,
        )

        if revoked:
            message = f"Ingestion job for {job.job_id} cancelled successfully."
        else:
            message = f"Job {job.job_id} is already cancelled."
    except asyncio.CancelledError:
        raise
    except HTTPException:
        raise
    except Exception as e:
        await logger.aerror("Error cancelling ingestion: %s", e)
        raise HTTPException(status_code=500, detail="Error cancelling ingestion.") from e
    else:
        return {"message": message}

View on GitHub (pinned to 976ec789d2)

Solutions

  1. Check server log 'Error cancelling ingestion: ...' for the chained cause
  2. Verify the task broker (Redis) is reachable — revoke_task needs it
  3. Check remote vector-store credentials/variables for the KB are still valid
  4. Retry the cancel; note the job may already be marked CANCELLED if the failure happened after update_job_status
Defensive patterns

Strategy: try-catch

Try / catch

try:
    await client.post(f"/api/v1/knowledge_bases/{kb_name}/cancel")
except httpx.HTTPStatusError as e:
    if e.response.status_code == 500:
        # job may already be CANCELLED — re-check state before retrying
        state = await get_latest_run_status(client, kb_name)
        if state == "cancelled":
            return
    raise

Prevention

When it happens

Trigger: task_service.revoke_task failing (broker down), job_service.update_job_status hitting a DB error, or chunk cleanup failing against a remote vector store (Mongo/Astra/Postgres) with a non-HTTP exception.

Common situations: Redis/task broker unavailable; remote vector-store credentials rotated so cleanup cannot connect; DB locked by a concurrent ingestion write.

Related errors


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