pulumi/pulumi · error
resolving stack: %w
Error message
resolving stack: %w
What it means
Before listing drift runs, the command resolves the target stack via RequireStack (LoadOnly). Any failure from that resolution — unknown stack, wrong project, auth/backend problems, or failure to load the stack — is wrapped with 'resolving stack: %w'. The drift commands need a concrete stack identity to call the Pulumi Cloud drift API.
Source
Thrown at pkg/cmd/pulumi/stack/stack_drift_list.go:133
cmd.Flags().IntVar(&dlcmd.count, "count", 0,
"Number of results to display (fetches multiple pages if needed)")
cmd.Flags().BoolVar(&dlcmd.all, "all", false,
"Fetch all results (mutually exclusive with --count)")
outputflag.Var(cmd.Flags(), &dlcmd.output)
return cmd
}
func defaultDriftListClientFactory(
ctx context.Context, stackFlag string,
) (driftListClient, client.StackIdentifier, error) {
ws := pkgWorkspace.Instance
opts := display.Options{Color: cmdutil.GetGlobalColorization()}
s, err := RequireStack(ctx, cmdutil.Diag(), ws, cmdBackend.DefaultLoginManager,
stackFlag, LoadOnly, opts, "")
if err != nil {
return nil, client.StackIdentifier{}, fmt.Errorf("resolving stack: %w", err)
}
cloudStack, ok := s.(httpstate.Stack)
if !ok {
return nil, client.StackIdentifier{},
errors.New("drift commands require the Pulumi Cloud backend; run `pulumi login`")
}
ref := cloudStack.Ref()
project := ""
if p, ok := ref.Project(); ok {
project = string(p)
}
stackID := client.StackIdentifier{
Owner: cloudStack.OrgName(),
Project: project,
Stack: ref.Name(),
}View on GitHub (pinned to 793f7b2e16)
Solutions
- Run `pulumi stack ls` to confirm the exact stack name and pass it via --stack.
- Run from the project directory (or pass an org/project/stack fully qualified name) so the stack reference resolves.
- Re-authenticate with `pulumi login` and check backend connectivity.
- Inspect the wrapped cause (the text after 'resolving stack:') for the specific failure and fix accordingly.
Example fix
// before (run outside project dir, ambiguous name) pulumi stack drift list --stack dev // after pulumi stack drift list --stack my-org/my-project/dev
Defensive patterns
Strategy: validation
Validate before calling
pulumi stack ls | grep 'my-org/my-project/dev' # ensure the stack resolves before drift list
Try / catch
if errText contains "resolving stack:" {
// fix stack ref / login per wrapped cause, then retry once
} Prevention
- Always pass fully qualified stack names (org/project/stack) in automation.
- Run drift commands from the project directory containing Pulumi.yaml.
- Check `pulumi whoami` and `pulumi stack ls` before scripted drift queries.
When it happens
Trigger: Running `pulumi stack drift list` when the --stack reference does not match an existing stack; the stack cannot be loaded from the current backend; credentials are expired or the backend is unreachable.
Common situations: Typos in the stack name or running from a directory without a Pulumi.yaml project so the fully qualified stack name cannot be derived; being logged into the wrong organization/backend; not logged in at all.
Related errors
- load stack: %w
- loading stack %q for decryption: %w
- loading stack %q: %w
- resolving stack: %w
- could not determine current cloud: %w
AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31).
Data as JSON: /api/errors/6f93ea9345ba6688.
Report an issue: GitHub.