pulumi/pulumi · error
resolving stack: %w
Error message
resolving stack: %w
What it means
`pulumi stack drift status` resolves the target stack with RequireStack (LoadOnly) before querying drift status from Pulumi Cloud. Any error from that resolution — stack not found, wrong project, backend/auth problems — is wrapped with 'resolving stack: %w', mirroring the drift list command.
Source
Thrown at pkg/cmd/pulumi/stack/stack_drift_status.go:110
constrictor.AttachArguments(cmd, constrictor.NoArgs)
cmd.Flags().StringVarP(&dscmd.stack, "stack", "s", "",
"The name of the stack to operate on. Defaults to the current stack")
outputflag.Var(cmd.Flags(), &dscmd.output)
return cmd
}
func defaultDriftStatusClientFactory(
ctx context.Context, stackFlag string,
) (driftStatusClient, 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` and pass the exact fully qualified stack name via --stack.
- Run from the project directory so the stack reference resolves correctly.
- Re-authenticate (`pulumi login`) and verify PULUMI_ACCESS_TOKEN in CI is valid.
- Read the wrapped cause text for the specific underlying failure.
Example fix
// before pulumi stack drift status --stack prod # in a dir with no Pulumi.yaml // after cd path/to/project && pulumi stack drift status --stack my-org/my-project/prod
Defensive patterns
Strategy: validation
Validate before calling
pulumi stack ls | grep -Fx 'my-org/my-project/dev' || exit 1
Try / catch
if errText contains "resolving stack:" {
// correct --stack ref or re-login, then retry
} Prevention
- Use fully qualified stack names in automation.
- Run from the project root so stack resolution has Pulumi.yaml context.
- Keep PULUMI_ACCESS_TOKEN valid and scoped in CI.
When it happens
Trigger: Running `pulumi stack drift status` when the --stack reference cannot be resolved to an existing loadable stack: nonexistent stack, missing Pulumi.yaml context, expired credentials, or unreachable backend.
Common situations: Typos in stack names; running the command outside the project directory; being logged into the wrong backend or organization; CI environments where PULUMI_ACCESS_TOKEN is missing or invalid.
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/23dbd19483e7e610.
Report an issue: GitHub.