Skip to content
DevOps AI ToolKit
Newsletter
All guides
AI for Pulumi By James Joyner IV · · 8 min read Last reviewed Jul 2026

Pulumi Error: 'No Stack Selected; Run pulumi stack select'

Quick answer

Fix Pulumi 'no stack selected; please use pulumi stack select' when reading config or running up: select or init a stack, and set --stack in CI non-interactively.

  • #pulumi
  • #iac
  • #troubleshooting
  • #errors
Free toolkit

Stuck on this Pulumi error? Get the free incident triage checklist

A one-page PDF — the exact steps to isolate, fix, and verify a production error like this one. No spam, unsubscribe anytime.

Exact Error Message

error: no stack selected; please use `pulumi stack select` or `pulumi stack init` to create or select a stack

You will hit this from pulumi config, pulumi config get, pulumi up, pulumi preview, pulumi refresh, or pulumi stack output whenever the CLI has no currently-selected stack in the project directory. In CI you often see it as the first failure of a fresh checkout because no stack has been selected yet.

What It Means

Pulumi organizes work into stacks (for example dev, staging, prod), each with its own configuration and state. Most commands operate on the currently-selected stack, and the CLI records that selection per project in ~/.pulumi/workspaces/<project>-workspace.json. When no stack is selected, Pulumi has no context to read config from or deploy against, so it stops and asks you to select or create one.

This is not a state or provider problem. It is a workspace/context problem: either you have never selected a stack in this directory, the workspace file is fresh (a clean CI checkout), or you are in the wrong directory without a Pulumi.yaml.

Common Causes

  • A fresh clone or CI runner where no stack has been selected yet (the workspace pointer does not exist).
  • Running a Pulumi command from a directory that has no Pulumi.yaml project file.
  • The selected stack was deleted (pulumi stack rm), leaving no current selection.
  • Automation/CI that assumes an interactive selection which never happened.
  • Multiple stacks exist but none is marked current, so ambiguous commands refuse to guess.

Diagnostic Commands

Confirm you are in a Pulumi project directory:

ls Pulumi.yaml
pulumi about

List the stacks that exist and see which, if any, is current:

pulumi stack ls

Ask directly which stack is selected (prints the name or the same error):

pulumi stack --show-name

Check whether the backend is even logged in (a logged-out CLI shows no stacks):

pulumi whoami

Step-by-Step Resolution

  1. Make sure you are in the directory that contains Pulumi.yaml. Every stack command resolves the project from that file:
cd path/to/pulumi-project
ls Pulumi.yaml
  1. If the stack already exists, select it:
pulumi stack select dev
  1. If no stack exists yet, create one and it becomes current automatically:
pulumi stack init dev
  1. Verify the selection took effect:
pulumi stack --show-name
  1. Now the config read works:
pulumi config
  1. In CI or any non-interactive context, never rely on a persisted selection. Pass --stack explicitly on every command so it works on a clean runner:
pulumi config --stack myorg/app/prod
pulumi up --stack myorg/app/prod --yes
  1. If a self-managed backend is involved, log in first so stacks are discoverable:
pulumi login s3://my-pulumi-state-bucket
pulumi stack select prod

Prevention

  • In CI, always pass --stack <org>/<project>/<name> (or set PULUMI_STACK) rather than depending on an interactive pulumi stack select.
  • Run pulumi stack select (or stack init) as an explicit early step in every pipeline, right after pulumi login.
  • Keep commands rooted in the project directory; wrapper scripts should cd to where Pulumi.yaml lives.
  • Use fully-qualified stack names (org/project/stack) in automation to avoid ambiguity across backends.
  • Do not pulumi stack rm the current stack without selecting another afterward.
  • Grab ready-made CI invocation snippets with --stack wired in from the Pulumi prompt library.
  • no Pulumi.yaml project file found — you are in the wrong directory entirely, a stricter form of this.
  • error: getting secrets manager: passphrase must be set — a stack is selected but its secrets config is missing.
  • stack '...' not found — the named stack does not exist on the backend.
  • error: PULUMI_ACCESS_TOKEN must be set — a login/auth failure that also blocks stack selection.

Frequently Asked Questions

Why does this only happen in CI and not on my laptop? Your laptop persisted a stack selection in its workspace file from a previous pulumi stack select. A fresh CI runner has no such file, so nothing is selected until you select it explicitly.

What is the difference between pulumi stack select and pulumi stack init? select switches to a stack that already exists; init creates a new one (and selects it). Use init the first time, select thereafter.

Can I avoid selecting a stack at all? Yes, pass --stack <org>/<project>/<name> on each command. That overrides the workspace selection and is the recommended pattern for automation.

Where is the stack selection stored? Per project, in ~/.pulumi/workspaces/<project>-<hash>-workspace.json. It is machine-local, which is why it does not travel with your repo into CI.

I selected a stack but pulumi config still errors. Confirm with pulumi stack --show-name that the selection actually took, and that you are in the directory with Pulumi.yaml. For more stack and config workflow patterns, see the Pulumi guides.

Free download · 368-page PDF

Fixed it? Get 500 Pulumi & DevOps AI prompts — free

500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.

  • 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
  • Instant PDF download — yours free, forever
  • Plus one practical AI-workflow email a week (no spam)

Single opt-in · unsubscribe anytime · no spam.

Did this fix your issue?

Free download · 368-page PDF

Get 500 Battle-Tested DevOps AI Prompts — Free

500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.

  • 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
  • Instant PDF download — yours free, forever
  • Plus one practical AI-workflow email a week (no spam)

Single opt-in · unsubscribe anytime · no spam.