{"record":{"id":"5e9e8b8bcd8de8b1","repo":"pulumi/pulumi","slug":"getting-latest-configuration-w","errorCode":null,"errorMessage":"getting latest configuration: %w","messagePattern":"getting latest configuration: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cmd/pulumi/config/config.go","lineNumber":607,"sourceCode":"\n\t\t\tvar configPath string\n\t\t\tif *configFile != \"\" {\n\t\t\t\tconfigPath = *configFile\n\t\t\t} else if s.ConfigLocation().IsRemote {\n\t\t\t\t// TODO: This should be possible in the future to reset the remote config back to previous used config.\n\t\t\t\t// See: https://github.com/pulumi/pulumi/issues/19557\n\t\t\t\treturn errors.New(\"cannot refresh stacks with remote config\")\n\t\t\t} else {\n\t\t\t\t_, path, err := workspace.DetectProjectStackPath(s.Ref().Name().Q())\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"getting configuration file: %w\", err)\n\t\t\t\t}\n\t\t\t\tconfigPath = path\n\t\t\t}\n\n\t\t\tlatest, err := backend.GetLatestConfiguration(ctx, s)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"getting latest configuration: %w\", err)\n\t\t\t}\n\n\t\t\tps, err := cmdStack.LoadProjectStack(ctx, cmdutil.Diag(), project, s, *configFile)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tps.Config = latest.Config\n\n\t\t\t// If the backend is returning envs, then we want to use them.\n\t\t\t//\n\t\t\t// We don't overwrite unconditionally because we don't want to to remove environments from users\n\t\t\t// that are using a non-cloud backend.\n\t\t\tif len(latest.Environments) > 0 {\n\t\t\t\tps.Environment = workspace.NewEnvironment(latest.Environments)\n\t\t\t}\n\n\t\t\t// Also restore the secrets provider from state","sourceCodeStart":589,"sourceCodeEnd":625,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/cmd/pulumi/config/config.go#L589-L625","documentation":"Wraps an error from backend.GetLatestConfiguration during `pulumi config refresh`. The backend (Pulumi Cloud or a self-hosted/DIY backend) failed to return the stack's most recent deployment configuration, so the refresh cannot proceed.","triggerScenarios":"Run `pulumi config refresh` when the backend call to fetch the latest configuration fails: stack has never been deployed (no latest config), backend API unreachable/unauthorized, or the stack was deleted server-side.","commonSituations":"Refreshing a brand-new stack that has never had `pulumi up` run; expired Pulumi Cloud access token; network outage or corporate proxy blocking api.pulumi.com; self-hosted backend misconfigured.","solutions":["Ensure the stack has at least one successful deployment (`pulumi up`) before refreshing.","Re-login with `pulumi login` and verify credentials (check for expired access token).","Check connectivity to the backend (api.pulumi.com or your self-hosted endpoint) and any proxy/firewall settings.","Verify the stack still exists in the backend with `pulumi stack ls`."],"exampleFix":"// before\npulumi config refresh  # fails on never-deployed stack\n// after\npulumi up              # create initial deployment\npulumi config refresh","handlingStrategy":"retry","validationCode":"# preflight: backend reachable and authenticated\npulumi whoami || { echo \"not logged in\"; exit 1; }\n# ensure stack has a latest deployment before refresh\npulumi stack ls --json | jq -e --arg s \"$STACK\" '.[] | select(.name==($s|split(\"/\")[-1]) and .lastUpdate != null)'","typeGuard":null,"tryCatchPattern":"for i in 1 2 3; do\n  pulumi config refresh && break\n  sleep $((i * 5))\ndone","preventionTips":["Run `pulumi up` at least once before attempting config refresh on a new stack.","Refresh tokens before expiry; use a service account token with adequate scope.","Verify network/proxy access to api.pulumi.com in CI.","Check `pulumi stack ls` to confirm the stack exists before scripting refresh."],"tags":["cli","pulumi","backend","network","configuration"],"backgroundTag":"backend-request-failed","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}