Invalid target address / No matching objects found (state commands) Terraform Origin: Platform & cloud OSI layer 7 · Application Last updated 5 Nov 2026

Terraform: Error: Invalid target address — No matching objects found. To view the available instances, use "terraform state list"

A state/target command referenced an address that doesn't exist in state.

Exact message you may see Error: Invalid target addressNo matching objects found. To view the available instances, use "terraform state list"Error: Invalid target address: No matching objects foundError: Invalid address: Resource instance keys not allowedError: Invalid target address Resource specification must include a resource type and name
Seen on: Terraform

Meaning

Run terraform state list and copy the exact address, including indexes/keys and module paths (module.x.aws_instance.web["a"]). Quote addresses with brackets in the shell ('aws_instance.web[0]'). Check workspace/backend is the right one — empty state lists nothing.

Common causes

  • Typo/wrong address
  • Missing index/key for count/for_each
  • Shell treating brackets/quotes
  • Wrong workspace/backend
  • Resource already removed

⚡ Quick fix

  1. terraform state list | grep NAME
  2. Quote the address: terraform state rm 'aws_instance.web["a"]'
  3. Check terraform workspace show

Detailed fix by platform

Terraform

  1. terraform state list | grep web; terraform state show 'aws_instance.web[0]'

How to diagnose

  1. Address — In state list?
  2. Quotes — Shell safe?
  3. Workspace — Right?

🔧 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…Cannot import non-existent remote object — Terraform: Error: Cannot import non-existent remote object — While attempting to import an existing object to "aws_s3_bucket.logs", the provider detected that no object exists with the given id (Terraform)Cannot import non-exi…docker-compose: command not found — docker-compose: command not found / 'compose' is not a docker command (Docker)docker-compose: comma…Error reading resource: not found (deleted outside Terraform) — Terraform: Error: reading EC2 Instance (i-0abc): couldn't find resource / 404 ResourceNotFound during refresh (Terraform)Error reading resourc…Firebase CLI: Authentication Error: Your credentials are no longer valid — Firebase CLI: Error: Authentication Error: Your credentials are no longer valid. Please run firebase login --reauth (Google Cloud / Firebase)Firebase CLI: Authent…invalid reference format — docker: invalid reference format (repository name must be lowercase) (Docker)invalid reference for…is not running — Error response from daemon: Container X is not running (Docker)is not runningNo such container — Error response from daemon: No such container (Docker)No such containerInvalid t…

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.