Skip to content

cycle: concurrent add-issue requests cause IntegrityError - bulk_create missing ignore_conflicts unlike module equivalent #9598

Description

@harsh4vardhan

Bug Description

CycleIssueViewSet.create uses �ulk_create without ignore_conflicts=True. The CycleIssue model has a partial unique constraint cycle_issue_when_deleted_at_null on (cycle, issue) where deleted_at IS NULL. Two concurrent POST requests adding the same issue to the same cycle both pass the existing-issue check (plain ilter, no row lock) and then both call �ulk_create. The second request raises an IntegrityError and returns HTTP 500.

The inconsistency is clear: ModuleIssueViewSet.create_module_issues in module/issue.py (line 237) performs the identical operation with ignore_conflicts=True. The cycle equivalent never received the same fix.

Affected file

�pps/api/plane/app/views/cycle/issue.py, line 264:

python created_records = CycleIssue.objects.bulk_create( [CycleIssue(...) for issue in new_issues], batch_size=10, # missing ignore_conflicts=True )

For comparison, �pps/api/plane/app/views/module/issue.py line 237:
python CycleIssue.objects.bulk_create(records, batch_size=10, ignore_conflicts=True)

Failure scenario

Two browser tabs open the same cycle simultaneously. Both click "Add issues" with overlapping issue selections. Both POST requests read no existing CycleIssue rows (race), both call �ulk_create, the second throws IntegrityError, user sees a 500 error and must retry.

Fix

python created_records = CycleIssue.objects.bulk_create( [CycleIssue(...) for issue in new_issues], batch_size=10, ignore_conflicts=True, )

Environment

Plane develop branch (2026-08-13).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions