makeplane/plane · warning · CommandError

No duplicate issues found with the given identifier

Error message

No duplicate issues found with the given identifier

What it means

Raised by `fix_duplicate_sequences` when the query `Issue.objects.filter(project=project, sequence_id=issue_sequence)` returns 0 or 1 rows — i.e. there is no duplicate to fix (line 55: `if not issues.count() > 1`). Operator precedence makes this `not (count > 1)`, so it triggers when count <= 1. Raised inside the try block, so re-wrapped via `except Exception as e: raise CommandError(str(e))` (message preserved). This is informational: the command found nothing to repair.

Source

Thrown at apps/api/plane/db/management/commands/fix_duplicate_sequences.py:56

        # Validate issue identifier
        try:
            identifier = issue_identifier.split("-")

            if len(identifier) != 2:
                raise ValueError("Invalid issue identifier format")

            project_identifier = identifier[0]
            issue_sequence = self.strict_str_to_int(identifier[1])

            # Fetch the project
            project = Project.objects.get(identifier__iexact=project_identifier, workspace__slug=workspace_slug)

            # Get the issues
            issues = Issue.objects.filter(project=project, sequence_id=issue_sequence)
            # Check if there are duplicate issues
            if not issues.count() > 1:
                raise CommandError("No duplicate issues found with the given identifier")

            self.stdout.write(self.style.SUCCESS(f"{issues.count()} issues found with identifier {issue_identifier}"))
            with transaction.atomic():
                # This ensures only one transaction per project can execute this code at a time
                lock_key = convert_uuid_to_integer(project.id)

                # Acquire an exclusive lock using the project ID as the lock key
                with connection.cursor() as cursor:
                    # Get an exclusive lock using the project ID as the lock key
                    cursor.execute("SELECT pg_advisory_xact_lock(%s)", [lock_key])

                # Get the maximum sequence ID for the project
                last_sequence = IssueSequence.objects.filter(project=project).aggregate(largest=Max("sequence"))[
                    "largest"
                ]

                bulk_issues = []
                bulk_issue_sequences = []

View on GitHub (pinned to 1c8a60f858)

Solutions

  1. Verify there really are duplicates first: `Issue.objects.filter(project=p, sequence_id=N).count()` — if <= 1, there is nothing to fix.
  2. Double-check the project identifier and sequence number match a real duplicate cluster.
  3. If count is 0, the project/sequence lookup may be wrong (case mismatch on identifier, wrong workspace slug).

Example fix

# before
python manage.py fix_duplicate_sequences 'PLANE-42'   # PLANE-42 is already unique
# after — confirm duplicates exist, then run only when count > 1
python manage.py shell -c "from plane.db.models import Project, Issue; p=Project.objects.get(identifier__iexact='PLANE'); print(Issue.objects.filter(project=p, sequence_id=42).count())"
Defensive patterns

Strategy: validation

Validate before calling

python manage.py shell -c "from plane.db.models import Project, Issue; p=Project.objects.get(identifier__iexact='PLANE'); import sys; n=Issue.objects.filter(project=p, sequence_id=42).count(); print(n); sys.exit(0 if n > 1 else 1)"

Type guard

def has_duplicate_sequence(project_identifier: str, workspace_slug: str, seq: int) -> bool:
    from plane.db.models import Project, Issue
    p = Project.objects.get(identifier__iexact=project_identifier, workspace__slug=workspace_slug)
    return Issue.objects.filter(project=p, sequence_id=seq).count() > 1

Try / catch

try:
    call_command('fix_duplicate_sequences', 'PLANE-42')
except CommandError as e:
    if 'No duplicate' in str(e):
        # nothing to repair — expected for healthy sequences
        ...

Prevention

When it happens

Trigger: Running the command on an issue identifier whose sequence_id is unique (0 or 1 matching issues), which is the normal/healthy state.

Common situations: Running the dedupe command preemptively or on already-repaired sequences; wrong identifier; sequence already unique.

Related errors


AI-assisted analysis of makeplane/plane@1c8a60f858 (2026-08-12). Data as JSON: /api/errors/fbc583bec240a0f1. Report an issue: GitHub.