{"record":{"id":"23dbd19483e7e610","repo":"pulumi/pulumi","slug":"resolving-stack-w-23dbd1","errorCode":null,"errorMessage":"resolving stack: %w","messagePattern":"resolving stack: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cmd/pulumi/stack/stack_drift_status.go","lineNumber":110,"sourceCode":"\tconstrictor.AttachArguments(cmd, constrictor.NoArgs)\n\n\tcmd.Flags().StringVarP(&dscmd.stack, \"stack\", \"s\", \"\",\n\t\t\"The name of the stack to operate on. Defaults to the current stack\")\n\toutputflag.Var(cmd.Flags(), &dscmd.output)\n\n\treturn cmd\n}\n\nfunc defaultDriftStatusClientFactory(\n\tctx context.Context, stackFlag string,\n) (driftStatusClient, client.StackIdentifier, error) {\n\tws := pkgWorkspace.Instance\n\topts := display.Options{Color: cmdutil.GetGlobalColorization()}\n\n\ts, err := RequireStack(ctx, cmdutil.Diag(), ws, cmdBackend.DefaultLoginManager,\n\t\tstackFlag, LoadOnly, opts, \"\")\n\tif err != nil {\n\t\treturn nil, client.StackIdentifier{}, fmt.Errorf(\"resolving stack: %w\", err)\n\t}\n\n\tcloudStack, ok := s.(httpstate.Stack)\n\tif !ok {\n\t\treturn nil, client.StackIdentifier{},\n\t\t\terrors.New(\"drift commands require the Pulumi Cloud backend; run `pulumi login`\")\n\t}\n\n\tref := cloudStack.Ref()\n\tproject := \"\"\n\tif p, ok := ref.Project(); ok {\n\t\tproject = string(p)\n\t}\n\tstackID := client.StackIdentifier{\n\t\tOwner:   cloudStack.OrgName(),\n\t\tProject: project,\n\t\tStack:   ref.Name(),\n\t}","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/cmd/pulumi/stack/stack_drift_status.go#L92-L128","documentation":"`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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\npulumi stack drift status --stack prod   # in a dir with no Pulumi.yaml\n// after\ncd path/to/project && pulumi stack drift status --stack my-org/my-project/prod","handlingStrategy":"validation","validationCode":"pulumi stack ls | grep -Fx 'my-org/my-project/dev' || exit 1","typeGuard":null,"tryCatchPattern":"if errText contains \"resolving stack:\" {\n    // correct --stack ref or re-login, then retry\n}","preventionTips":["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."],"tags":["cli","stack","backend"],"backgroundTag":"stack-not-found","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}