Loading
Show the API message when an environment delete returns 409 or 429
What does this MR do and why?
Context
In !269154 (merged), we delete environments in batches with a per-user rows limit. A delete that runs out of time returns 409 and asks for a retry, and a user over the limit gets 429. The environments page deletes through the REST API and shows "Check if the environment stopped; if not, stop it and try again." for every failure, which is the wrong advice for both.
This MR
- The delete environment modal shows the API's message for
409and429responses. - Every other failure, and a
409or429without a message, keeps the current text. A delete of an environment that isn't stopped returns a bare403 Forbidden, so the current hint stays more useful there.
Users who hit a partial delete or the rows limit learn to retry or wait instead of being told to stop an environment that is already stopped.
References
- https://gitlab.com/gitlab-org/gitlab/-/work_items/638251+
- https://gitlab.com/gitlab-org/gitlab/-/work_items/639045+
- Delete environments in batches with a per-user ... (!269154 - merged)
Screenshots or screen recordings
| Before | After |
|---|---|
![]() |
![]() |
How to set up and validate locally
- Check out the batched delete branch with this MR's commit on top:
git fetch origin environment-delete-batched environment-delete-error-message git checkout -b try-environment-delete-message origin/environment-delete-batched git cherry-pick origin/environment-delete-error-message - In a project you maintain, create two stopped environments with a few deployments each through the Deployments API.
- In a Rails console, enable batched deletes and the rows limit, and set a small limit:
Feature.enable(:environment_delete_in_batches) Feature.enable(:rate_limit_environment_delete_rows) ApplicationSetting.current.update!(environment_delete_rows_limit_per_user: 1) - Wait a minute, then from Operate > Environments > Stopped, delete both environments within the same minute. The first is deleted. The second shows "This endpoint has been requested too many times. Try again later." and keeps its deployments.
- Clean up:
Feature.removeboth flags and reset the setting to20000.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Leaminn Ma

