Pulumi "getting stack: ... not logged in" in CI
A Pulumi command that needs a backend ran while the CLI has no active login, so it cannot resolve the stack. In CI there is no cached session, so the very first command hits this unless you log in first.
What this error means
A step such as pulumi stack select or pulumi up fails with "error: getting stack: ...: not logged in" or "PULUMI_ACCESS_TOKEN or a login is required".
pulumi
error: getting stack: getting secrets manager: no stack named 'dev' found:
not logged in. Please run `pulumi login`.Common causes
No login step before the Pulumi command
CI never ran pulumi login and provided no token, so the CLI has no backend session to look the stack up in.
Login state from a prior step did not carry over
A login in one job or container does not persist to a later one, so the second job appears logged out.
How to fix it
Log in before touching a stack
- Set
PULUMI_ACCESS_TOKEN(Cloud) or backend credentials (self-managed). - Run
pulumi loginearly in the job, or let the setup action handle it. - Then select the stack and run your command.
Terminal
pulumi login
pulumi stack select devUse the Pulumi GitHub action, which logs in for you
The official action logs in when given a token, avoiding a separate login step.
.github/workflows/ci.yml
- uses: pulumi/actions@v6
with:
command: up
stack-name: dev
env:
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}How to prevent it
- Always log in (or pass a token) before any stack command.
- Keep login and stack commands in the same job so state persists.
- Set the token at job level so every Pulumi step is authenticated.
Related guides
Pulumi "PULUMI_ACCESS_TOKEN must be set for login during non-interactive CLI sessions" in CIFix Pulumi "error: PULUMI_ACCESS_TOKEN must be set for login during non-interactive CLI sessions" in CI - the…
Pulumi "no stack named ... found" in CIFix Pulumi "error: no stack named X found" in CI - the CLI is logged into a backend or organization that does…
Pulumi "pulumi: command not found" on the runner in CIFix "pulumi: command not found" in CI - the Pulumi CLI is not installed on the runner or not on PATH, usually…