{"record":{"id":"6ee1c8b2e87189ef","repo":"pulumi/pulumi","slug":"saving-stack-config-w-6ee1c8","errorCode":null,"errorMessage":"saving stack config: %w","messagePattern":"saving stack config: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cmd/pulumi/stack/stack_history.go","lineNumber":110,"sourceCode":"\t\t\t\treturn fmt.Errorf(\"getting history: %w\", err)\n\t\t\t}\n\t\t\tvar decrypter config.Decrypter\n\t\t\tif showSecrets {\n\t\t\t\tproject, _, err := ws.ReadProject(\"\")\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"loading project: %w\", err)\n\t\t\t\t}\n\t\t\t\tps, err := LoadProjectStack(ctx, cmdutil.Diag(), project, s, \"\")\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"getting stack config: %w\", err)\n\t\t\t\t}\n\t\t\t\tcrypter, state, err := ssml.GetDecrypter(ctx, s, ps)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"decrypting secrets: %w\", err)\n\t\t\t\t}\n\t\t\t\tif state != SecretsManagerUnchanged {\n\t\t\t\t\tif err = SaveProjectStack(ctx, s, ps, \"\"); err != nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"saving stack config: %w\", err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdecrypter = crypter\n\t\t\t}\n\n\t\t\tif showSecrets {\n\t\t\t\tLog3rdPartySecretsProviderDecryptionEvent(ctx, s, \"\", \"pulumi stack history\")\n\t\t\t}\n\n\t\t\treturn output.Get()(cmd.OutOrStdout(), updates, decrypter)\n\t\t},\n\t}\n\n\tconstrictor.AttachArguments(cmd, constrictor.NoArgs)\n\n\tcmd.Flags().StringVarP(\n\t\t&stack, \"stack\", \"s\", \"\",\n\t\t\"Choose a stack other than the currently selected one\")","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/cmd/pulumi/stack/stack_history.go#L92-L128","documentation":"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.","triggerScenarios":"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.","commonSituations":"Running the CLI in a read-only container or CI checkout, file owned by another user, disk full, editor/another process holding conflicting writes.","solutions":["Ensure the project directory is writable (check permissions, read-only mounts)","Free disk space if the filesystem is full","Run the command from a writable checkout (not a read-only container mount)","If the file is fine, re-run; concurrent-edit conflicts are transient"],"exampleFix":"// before\nchmod 444 Pulumi.dev.yaml && pulumi stack history --show-secrets\n\n// after\nchmod 644 Pulumi.dev.yaml && pulumi stack history --show-secrets","handlingStrategy":"validation","validationCode":"test -w . && test -w Pulumi.dev.yaml && echo writable || echo not-writable","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run CLI commands from writable checkouts, not read-only containers","Ensure correct file ownership/permissions on stack config files","Avoid running concurrent pulumi commands against the same stack directory"],"tags":["cli","filesystem","stack-config"],"backgroundTag":"config-file-write-failure","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}