pulumi/pulumi · error

saving stack config: %w

Error message

saving stack config: %w

What it means

Wraps a failure to save the project stack file after the secrets manager was initialized during `pulumi stack history --show-secrets`. When GetDecrypter reports the secrets manager state changed (e.g. new EncryptedKey), the CLI persists the updated Pulumi.<stack>.yaml; this error means that write failed.

Source

Thrown at pkg/cmd/pulumi/stack/stack_history.go:110

				return fmt.Errorf("getting history: %w", err)
			}
			var decrypter config.Decrypter
			if showSecrets {
				project, _, err := ws.ReadProject("")
				if err != nil {
					return fmt.Errorf("loading project: %w", err)
				}
				ps, err := LoadProjectStack(ctx, cmdutil.Diag(), project, s, "")
				if err != nil {
					return fmt.Errorf("getting stack config: %w", err)
				}
				crypter, state, err := ssml.GetDecrypter(ctx, s, ps)
				if err != nil {
					return fmt.Errorf("decrypting secrets: %w", err)
				}
				if state != SecretsManagerUnchanged {
					if err = SaveProjectStack(ctx, s, ps, ""); err != nil {
						return fmt.Errorf("saving stack config: %w", err)
					}
				}
				decrypter = crypter
			}

			if showSecrets {
				Log3rdPartySecretsProviderDecryptionEvent(ctx, s, "", "pulumi stack history")
			}

			return output.Get()(cmd.OutOrStdout(), updates, decrypter)
		},
	}

	constrictor.AttachArguments(cmd, constrictor.NoArgs)

	cmd.Flags().StringVarP(
		&stack, "stack", "s", "",
		"Choose a stack other than the currently selected one")

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Ensure the project directory is writable (check permissions, read-only mounts)
  2. Free disk space if the filesystem is full
  3. Run the command from a writable checkout (not a read-only container mount)
  4. If the file is fine, re-run; concurrent-edit conflicts are transient

Example fix

// before
chmod 444 Pulumi.dev.yaml && pulumi stack history --show-secrets

// after
chmod 644 Pulumi.dev.yaml && pulumi stack history --show-secrets
Defensive patterns

Strategy: validation

Validate before calling

test -w . && test -w Pulumi.dev.yaml && echo writable || echo not-writable

Prevention

When it happens

Trigger: Running `pulumi stack history --show-secrets` when the secrets manager state changed and SaveProjectStack cannot write Pulumi.<stack>.yaml — read-only filesystem, insufficient permissions, or the file being locked/replaced concurrently.

Common situations: Running the CLI in a read-only container or CI checkout, file owned by another user, disk full, editor/another process holding conflicting writes.

Related errors


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