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

  1. Create a new group
  2. Create a project inside that group
  3. Navigate to the group's Settings > General > Advanced
  4. Click "Archive" to archive the group
  5. Click "Unarchive" to unarchive the group
  6. Navigate to the project's Settings > General > Advanced
  7. 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.

Edited by 🤖 GitLab Bot 🤖