Skip to content
Latchkey

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

  1. Set PULUMI_ACCESS_TOKEN (Cloud) or backend credentials (self-managed).
  2. Run pulumi login early in the job, or let the setup action handle it.
  3. Then select the stack and run your command.
Terminal
pulumi login
pulumi stack select dev

Use 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

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →