Cannot archive project after parent group is archived and unarchived
Summary
Projects become unable to be archived after their parent group undergoes an archive/unarchive cycle, resulting in a 400 Failed to archive project error.
Steps to Reproduce
- Create a new group
- Create a project inside that group
- Navigate to the group's Settings > General > Advanced
- Click "Archive" to archive the group
- Click "Unarchive" to unarchive the group
- Navigate to the project's Settings > General > Advanced
- Click "Archive" to archive the project
Expected Behavior
The project should be archived successfully and display an "Archived" badge.
Actual Behavior
The archive operation fails with:
- HTTP Status Code:
400 - Error Message:
Failed to archive project
The project remains unarchived and cannot be archived through the UI or API.
Environment
- Deployment Type: GitLab.com (SaaS)
- GitLab Version: 18.10.0
-
API Endpoint Affected:
POST /api/v4/projects/:id/archive
Potential cause
This seems like a problem with the state machine.
By following the reproduction steps in the issue a project is left with:
gitlab(prod)> project.state
=> 1
gitlab(prod)> project.archived
=> false
Which should not be possible. When attempting to archive the project again, that transition (1 => 1) is invalid. The above is surely caused by the Group unarchive action, but not sure how.
Impact
Projects affected by this issue cannot be archived, preventing users from making them read-only for preservation purposes. This is 100% reproducible following the exact sequence above.