Workspace doesn't exist Terraform Origin: Platform & cloud OSI layer 7 · Application Last updated 5 Nov 2026

Terraform: Error: Failed to select workspace: workspace "staging" doesn't exist / Currently selected workspace "x" does not exist

The workspace you selected (or that .terraform/environment points to) isn't present in the backend.

Exact message you may see Error: Failed to select workspace: workspace "staging" doesn't existCurrently selected workspace "x" does not existError: Workspace "staging" doesn't exist. You can create this workspace with the "new" subcommandError: Failed to select workspaceworkspace does not exist terraform
Seen on: Terraform

Meaning

Create it (terraform workspace new staging) or select an existing one (terraform workspace list). With remote backends, state lives per workspace key/prefix; wrong backend config shows no workspaces. In CI use terraform workspace select -or-create staging.

Common causes

  • Workspace never created
  • Different backend/key prefix
  • .terraform/environment stale
  • Workspace deleted
  • TF_WORKSPACE env var set to a missing name

⚡ Quick fix

  1. terraform workspace new NAME or workspace select -or-create NAME
  2. Check backend workspace_key_prefix/bucket
  3. Unset a stale TF_WORKSPACE

Detailed fix by platform

Terraform

  1. terraform workspace list && terraform workspace select -or-create staging

How to diagnose

  1. List — Workspaces shown?
  2. Backend — Same config?
  3. Env — TF_WORKSPACE?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):

Backend configuration changed (migrate or reconfigure) — Terraform: Error: Backend configuration changed — A change in the backend configuration has been detected, which may require migrating existing state (Terraform)Backend configuration…Backend initialization required — Terraform: Error: Backend initialization required, please run "terraform init" — Reason: Initial configuration of the requested backend "s3" (Terraform)Backend initializatio…Error building ARM Config: obtain subscription from Azure CLI — Terraform: Error: building AzureRM Client: obtaining subscription ID / Please run 'az login' to setup account (Terraform)Error building ARM Co…Invalid AWS Region — Terraform: Error: Invalid AWS Region: us-east-3 / Error: configuring Terraform AWS Provider: validating provider credentials: operation error STS: GetCallerIdentity (Terraform)Invalid AWS RegionInvalid target address / No matching objects found (state commands) — Terraform: Error: Invalid target address — No matching objects found. To view the available instances, use "terraform state list" (Terraform)Invalid target addres…No valid credential sources found (AWS provider) — Terraform: Error: No valid credential sources found — failed to refresh cached credentials, no EC2 IMDS role found / Error: configuring Terraform AWS Provider: no valid credential sources (Terraform)No valid credential s…S3 backend: NoSuchBucket / bucket does not exist — Terraform: Error: Failed to get existing workspaces: S3 bucket "my-tf-state" does not exist / NoSuchBucket: The specified bucket does not exist (Terraform)S3 backend: NoSuchBuc…UnauthorizedOperation / AccessDenied during Terraform apply — Terraform: Error: creating EC2 Instance: UnauthorizedOperation: You are not authorized to perform this operation. User: arn:aws:iam::123:user/ci is not authorized to perform: ec2:RunInstances (Terraform)UnauthorizedOperation…Workspace…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.