Problem
When you attempt to change the name of a workspace in HCP Terraform or Terraform Enterprise, you receive the following error, even if there are no pending runs visible in the UI.
Name cannot be changed while a run has not completed
Cause
This validation error occurs when the workspace contains one or more runs with a status that is not considered a terminal state. A workspace name can only be changed if all associated runs have one of the following statuses: applied, discarded, errored, canceled, policy_soft_failed, planned_and_finished, assessed, or assessing.
Runs in other states, such as pending or plan_queued, will block the name change operation.
Solutions
Solution 1: Identify and Resolve Incomplete Runs
You must ensure all runs in the workspace are in a completed state before renaming the workspace.
- Navigate to the Runs tab in the affected workspace and review the list for any runs that are not in a terminal state. Address these runs by either canceling or completing them.
- If you cannot identify the blocking runs in the UI, you can use the List runs in a workspace API endpoint to view the current status of all runs associated with the workspace.
Outcome
After you ensure all runs are in a valid terminal status, you can successfully rename the workspace.
Additional Information
- For a complete list of possible run statuses, refer to the Run States API Documentation.