{"record":{"id":"fbc583bec240a0f1","repo":"makeplane/plane","slug":"no-duplicate-issues-found-with-the-given-identifie","errorCode":null,"errorMessage":"No duplicate issues found with the given identifier","messagePattern":"No duplicate issues found with the given identifier","errorType":"exception","errorClass":"CommandError","httpStatus":null,"severity":"warning","filePath":"apps/api/plane/db/management/commands/fix_duplicate_sequences.py","lineNumber":56,"sourceCode":"\n        # Validate issue identifier\n        try:\n            identifier = issue_identifier.split(\"-\")\n\n            if len(identifier) != 2:\n                raise ValueError(\"Invalid issue identifier format\")\n\n            project_identifier = identifier[0]\n            issue_sequence = self.strict_str_to_int(identifier[1])\n\n            # Fetch the project\n            project = Project.objects.get(identifier__iexact=project_identifier, workspace__slug=workspace_slug)\n\n            # Get the issues\n            issues = Issue.objects.filter(project=project, sequence_id=issue_sequence)\n            # Check if there are duplicate issues\n            if not issues.count() > 1:\n                raise CommandError(\"No duplicate issues found with the given identifier\")\n\n            self.stdout.write(self.style.SUCCESS(f\"{issues.count()} issues found with identifier {issue_identifier}\"))\n            with transaction.atomic():\n                # This ensures only one transaction per project can execute this code at a time\n                lock_key = convert_uuid_to_integer(project.id)\n\n                # Acquire an exclusive lock using the project ID as the lock key\n                with connection.cursor() as cursor:\n                    # Get an exclusive lock using the project ID as the lock key\n                    cursor.execute(\"SELECT pg_advisory_xact_lock(%s)\", [lock_key])\n\n                # Get the maximum sequence ID for the project\n                last_sequence = IssueSequence.objects.filter(project=project).aggregate(largest=Max(\"sequence\"))[\n                    \"largest\"\n                ]\n\n                bulk_issues = []\n                bulk_issue_sequences = []","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/makeplane/plane/blob/1c8a60f858d8472aa56e29994ec1c7926da2c6ce/apps/api/plane/db/management/commands/fix_duplicate_sequences.py#L38-L74","documentation":"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.","triggerScenarios":"Running the command on an issue identifier whose sequence_id is unique (0 or 1 matching issues), which is the normal/healthy state.","commonSituations":"Running the dedupe command preemptively or on already-repaired sequences; wrong identifier; sequence already unique.","solutions":["Verify there really are duplicates first: `Issue.objects.filter(project=p, sequence_id=N).count()` — if <= 1, there is nothing to fix.","Double-check the project identifier and sequence number match a real duplicate cluster.","If count is 0, the project/sequence lookup may be wrong (case mismatch on identifier, wrong workspace slug)."],"exampleFix":"# before\npython manage.py fix_duplicate_sequences 'PLANE-42'   # PLANE-42 is already unique\n# after — confirm duplicates exist, then run only when count > 1\npython 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())\"","handlingStrategy":"validation","validationCode":"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)\"","typeGuard":"def has_duplicate_sequence(project_identifier: str, workspace_slug: str, seq: int) -> bool:\n    from plane.db.models import Project, Issue\n    p = Project.objects.get(identifier__iexact=project_identifier, workspace__slug=workspace_slug)\n    return Issue.objects.filter(project=p, sequence_id=seq).count() > 1","tryCatchPattern":"try:\n    call_command('fix_duplicate_sequences', 'PLANE-42')\nexcept CommandError as e:\n    if 'No duplicate' in str(e):\n        # nothing to repair — expected for healthy sequences\n        ...","preventionTips":["Confirm duplicates exist (count > 1) before running — this is a repair-only command.","Double-check project identifier and workspace slug.","Treat this error as informational, not a failure."],"tags":["django","management-command","validation","no-op","plane"],"backgroundTag":null,"analyzedSha":"1c8a60f858d8472aa56e29994ec1c7926da2c6ce","analyzedAt":"2026-08-12T14:44:31.636Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}