pulumi/pulumi · error

getting latest configuration: %w

Error message

getting latest configuration: %w

What it means

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.

Source

Thrown at pkg/cmd/pulumi/config/config.go:607

			var configPath string
			if *configFile != "" {
				configPath = *configFile
			} else if s.ConfigLocation().IsRemote {
				// TODO: This should be possible in the future to reset the remote config back to previous used config.
				// See: https://github.com/pulumi/pulumi/issues/19557
				return errors.New("cannot refresh stacks with remote config")
			} else {
				_, path, err := workspace.DetectProjectStackPath(s.Ref().Name().Q())
				if err != nil {
					return fmt.Errorf("getting configuration file: %w", err)
				}
				configPath = path
			}

			latest, err := backend.GetLatestConfiguration(ctx, s)
			if err != nil {
				return fmt.Errorf("getting latest configuration: %w", err)
			}

			ps, err := cmdStack.LoadProjectStack(ctx, cmdutil.Diag(), project, s, *configFile)
			if err != nil {
				return err
			}

			ps.Config = latest.Config

			// If the backend is returning envs, then we want to use them.
			//
			// We don't overwrite unconditionally because we don't want to to remove environments from users
			// that are using a non-cloud backend.
			if len(latest.Environments) > 0 {
				ps.Environment = workspace.NewEnvironment(latest.Environments)
			}

			// Also restore the secrets provider from state

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Ensure the stack has at least one successful deployment (`pulumi up`) before refreshing.
  2. Re-login with `pulumi login` and verify credentials (check for expired access token).
  3. Check connectivity to the backend (api.pulumi.com or your self-hosted endpoint) and any proxy/firewall settings.
  4. Verify the stack still exists in the backend with `pulumi stack ls`.

Example fix

// before
pulumi config refresh  # fails on never-deployed stack
// after
pulumi up              # create initial deployment
pulumi config refresh
Defensive patterns

Strategy: retry

Validate before calling

# preflight: backend reachable and authenticated
pulumi whoami || { echo "not logged in"; exit 1; }
# ensure stack has a latest deployment before refresh
pulumi stack ls --json | jq -e --arg s "$STACK" '.[] | select(.name==($s|split("/")[-1]) and .lastUpdate != null)'

Try / catch

for i in 1 2 3; do
  pulumi config refresh && break
  sleep $((i * 5))
done

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31). Data as JSON: /api/errors/5e9e8b8bcd8de8b1. Report an issue: GitHub.