#10700·celery

ArangoDB: `ArangoDbBackend.delete()` raises when deleting a missing document

Author: Namraa310806Created Sep 24, 2026Updated Sep 24, 2026
LabelsIssue Type: Bug Report

Checklist

Mandatory Debugging Information

  • I have verified that the issue exists against the main branch of Celery.
  • I have included the output of celery -A proj report in the issue.
  • I have specified the Celery version affected below.
  • I have included the contents of pip freeze in the issue.
  • I have included the versions of the external dependencies relevant to reproducing this bug.

Optional Debugging Information

  • I have tried reproducing the issue on more than one Python version and/or implementation.
  • I have tried reproducing the issue on more than one message broker and/or result backend.
  • I have tried reproducing the issue on more than one version of the message broker and/or result backend.
  • I have tried reproducing the issue on more than one operating system.
  • I have tried reproducing the issue on more than one workers pool.
  • I have tried reproducing the issue with autoscaling, retries, ETA/Countdown & rate limits disabled.
  • I have tried reproducing the issue after downgrading and/or upgrading Celery and its dependencies.

Related Issues and Possible Duplicates

Related Issues

  • None found.

Possible Duplicates

  • None found.

Environment & Settings

Celery version: 5.7.0a1 (current main)

celery report Output:

Not available; issue reproduced directly against the current Celery main branch.

Steps to Reproduce

Required Dependencies

  • Minimal Python Version: Python version used by the test environment
  • Minimal Celery Version: 5.7.0a1 / current main
  • Minimal Kombu Version: N/A
  • Minimal Broker Version: N/A
  • Minimal Result Backend Version: ArangoDB
  • Minimal OS and/or Kernel Version: N/A
  • Minimal Broker Client Version: N/A
  • Minimal Result Backend Client Version: pyArango version used by the environment

Python Packages

pip freeze Output:

Not included; the issue is isolated to the ArangoDB backend implementation.

Other Dependencies

ArangoDB is required to reproduce the backend behavior.

The relevant backend implementation is:

celery/backends/arangodb.py

Minimally Reproducible Test Case

The issue occurs when ArangoDbBackend.delete() attempts to remove a key that does not exist.

The current implementation executes:

python
def delete(self, key):
    if key is None:
        return
    self.db.AQLQuery(
        "REMOVE {_key: @key} IN @@collection",
        bindVars={
            "@collection": self.collection,
            "key": key,
        },
    )

A minimal reproduction is:

python
backend.delete("key-that-does-not-exist")

When the key does not exist in the ArangoDB collection, ArangoDB raises ERROR_ARANGO_DOCUMENT_NOT_FOUND (error code 1202), which is surfaced by pyArango as an AQLQueryError.

The same problem can be reached through:

python
AsyncResult(task_id).forget()

when the corresponding result document is already absent.

Expected Behavior

ArangoDbBackend.delete() should be safe to call when the requested key does not exist.

Deleting an already-absent result should behave as an idempotent no-op rather than raising an uncaught backend exception.

In particular:

python
AsyncResult(task_id).forget()

should not fail merely because the corresponding result document is already absent.

Actual Behavior

ArangoDbBackend.delete() executes an AQL REMOVE without ignoreErrors.

When the requested document does not exist, ArangoDB raises:

ERROR_ARANGO_DOCUMENT_NOT_FOUND

which is surfaced by pyArango as an AQLQueryError.

This causes forget() to propagate the backend exception instead of completing as a no-op.

The relevant query is currently:

sql
REMOVE {_key: @key} IN @@collection

ArangoDB supports suppressing this specific missing-document error using:

sql
OPTIONS { ignoreErrors: true }

A regression test for the missing-document case passes after adding this option, together with the existing ArangoDB backend tests (14 tests total).