pulumi/pulumi · error

saving project: %w

Error message

saving project: %w

What it means

After populating a project (name, description, clearing the template field) from a template instantiation, the CLI persists Pulumi.yaml via pkgWorkspace.SaveProject. If serialization or the file write fails, the error is wrapped as 'saving project'. The update cannot proceed without a valid project file in the workspace.

Source

Thrown at pkg/cmd/pulumi/operations/up.go:427

				return err
			}
		}

		// Copy the template files from the repo to the temporary "virtual workspace" directory.
		if err = cmdTemplates.CopyTemplateFiles(template.Dir, temp, true, name, description); err != nil {
			return err
		}

		// Load the project, update the name & description, remove the template section, and save it.
		proj, root, err := ws.ReadProject("")
		if err != nil {
			return err
		}
		proj.Name = tokens.PackageName(name)
		proj.Description = &description
		proj.Template = nil
		if err = pkgWorkspace.SaveProject(proj); err != nil {
			return fmt.Errorf("saving project: %w", err)
		}

		// Create the stack, if needed.
		if s == nil {
			if s, err = newcmd.PromptAndCreateStack(ctx, cmdutil.Diag(), ws, b, ui.PromptForValue, stackName, root,
				false /*setCurrent*/, yes, opts.Display, secretsProvider, false /*useRemoteConfig*/, configFile); err != nil {
				return err
			}
			// cmdStack.CreateStack prints "Created stack '<stack>'" on success.
		}

		// Prompt for config values (if needed) and save.
		if err = newcmd.HandleConfig(
			ctx,
			cmdutil.Diag(),
			ssml,
			ws,
			ui.PromptForValue,

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Check write permissions on Pulumi.yaml and its directory; make the checkout writable.
  2. Ensure the disk is not full and the user has quota remaining.
  3. Remove invalid characters from the project name/description derived from the template.
  4. Close editors/sync tools holding a lock on Pulumi.yaml and retry.
  5. Delete a corrupt Pulumi.yaml and regenerate it from the template.

Example fix

// before
proj.Name = tokens.PackageName(name)
proj.Description = &description
// after (sanitize values before saving)
proj.Name = tokens.PackageName(name)
cleanDesc := strings.Map(func(r rune) rune {
	if r == 0 || r == '\n' || r == '\r' { return -1 }
	return r
}, description)
proj.Description = &cleanDesc
if err = pkgWorkspace.SaveProject(proj); err != nil {
	return fmt.Errorf("saving project: %w", err)
}
Defensive patterns

Strategy: validation

Validate before calling

info, err := os.Stat("Pulumi.yaml"); if err == nil && info.Mode().Perm()&0200 == 0 { return errors.New("Pulumi.yaml not writable") }

Try / catch

if err != nil && strings.Contains(err.Error(), "saving project") { // check writability then retry
	return fmt.Errorf("check Pulumi.yaml permissions/disk space: %w", err) }

Prevention

When it happens

Trigger: pkgWorkspace.SaveProject(proj) returns an error: unwritable Pulumi.yaml (permissions, read-only checkout), YAML marshal failure from invalid characters in name/description, or disk full.

Common situations: Running pulumi up inside a read-only mounted repo; template description containing characters that break serialization; file locked by an editor/sync client (Dropbox/OneDrive); disk quota exceeded.

Related errors


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