pulumi/pulumi · error

found project settings, but failed to load: %w

Error message

found project settings, but failed to load: %w

What it means

readProjectSettingsFromDir finds a Pulumi.yaml (or .yml/.json) file in the workspace directory, but workspace.LoadProject failed to parse it. This means project settings exist but are invalid — usually malformed YAML/JSON or missing required fields like name/runtime.

Source

Thrown at sdk/go/auto/local_workspace.go:1604

// s, o/p/s, u/p/s o/s
// so just return the last chunk which is what will be used in pulumi.<stack>.yaml
func getStackSettingsName(stackName string) string {
	parts := strings.Split(stackName, "/")
	if len(parts) < 1 {
		return stackName
	}
	return parts[len(parts)-1]
}

const pulumiHomeEnv = "PULUMI_HOME"

func readProjectSettingsFromDir(ctx context.Context, workDir string) (*workspace.Project, error) {
	for _, ext := range settingsExtensions {
		projectPath := filepath.Join(workDir, "Pulumi"+ext)
		if _, err := os.Stat(projectPath); err == nil {
			proj, err := workspace.LoadProject(projectPath)
			if err != nil {
				return nil, fmt.Errorf("found project settings, but failed to load: %w", err)
			}
			return proj, nil
		}
	}
	return nil, errors.New("unable to find project settings in workspace")
}

func getProjectSettings(
	ctx context.Context,
	projectName string,
	opts []LocalWorkspaceOption,
) (*workspace.Project, error) {
	var optsBag localWorkspaceOptions
	for _, opt := range opts {
		opt.applyLocalWorkspaceOption(&optsBag)
	}

	// If the Project is included in the opts, just use that.

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Fix the YAML/JSON syntax in the Pulumi.yaml file indicated by the wrapped error
  2. Ensure required fields name, runtime (and main if applicable) are present
  3. Remove or correct unknown/typo'd keys not accepted by the schema
  4. Validate the file against a known-good Pulumi.yaml from a working project
  5. Regenerate the project file (pulumi new) if it is badly corrupted

Example fix

# before (Pulumi.yaml)
name: my-project
runtime:  # empty value
# after
name: my-project
runtime: go
Defensive patterns

Strategy: validation

Validate before calling

func validatePulumiYaml(dir string) error {
	proj, err := workspace.LoadProject(filepath.Join(dir, "Pulumi.yaml"))
	if err != nil { return err }
	if proj.Name == "" || proj.Runtime.Name() == "" { return errors.New("name and runtime required") }
	return nil
}

Try / catch

proj, err := readProjectSettingsFromDir(ctx, workDir)
if err != nil {
	var loadErr *fs.PathError
	if errors.As(err, &loadErr) { /* file missing vs parse error differ */ }
	return err
}

Prevention

When it happens

Trigger: Any workspace/stack creation that reads project settings from workDir when Pulumi.<ext> exists but fails to parse: invalid YAML syntax, unknown schema fields, missing name/runtime/main, wrong extension content.

Common situations: Hand-edited Pulumi.yaml with indentation errors; a Pulumi.yaml from a newer SDK with unsupported keys; a file with the right name but wrong format (e.g. JSON content in a .yaml file); project missing the required 'runtime' section.

Related errors


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