{"record":{"id":"fce0e601615626b3","repo":"pulumi/pulumi","slug":"found-project-settings-but-failed-to-load-w","errorCode":null,"errorMessage":"found project settings, but failed to load: %w","messagePattern":"found project settings, but failed to load: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdk/go/auto/local_workspace.go","lineNumber":1604,"sourceCode":"// s, o/p/s, u/p/s o/s\n// so just return the last chunk which is what will be used in pulumi.<stack>.yaml\nfunc getStackSettingsName(stackName string) string {\n\tparts := strings.Split(stackName, \"/\")\n\tif len(parts) < 1 {\n\t\treturn stackName\n\t}\n\treturn parts[len(parts)-1]\n}\n\nconst pulumiHomeEnv = \"PULUMI_HOME\"\n\nfunc readProjectSettingsFromDir(ctx context.Context, workDir string) (*workspace.Project, error) {\n\tfor _, ext := range settingsExtensions {\n\t\tprojectPath := filepath.Join(workDir, \"Pulumi\"+ext)\n\t\tif _, err := os.Stat(projectPath); err == nil {\n\t\t\tproj, err := workspace.LoadProject(projectPath)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"found project settings, but failed to load: %w\", err)\n\t\t\t}\n\t\t\treturn proj, nil\n\t\t}\n\t}\n\treturn nil, errors.New(\"unable to find project settings in workspace\")\n}\n\nfunc getProjectSettings(\n\tctx context.Context,\n\tprojectName string,\n\topts []LocalWorkspaceOption,\n) (*workspace.Project, error) {\n\tvar optsBag localWorkspaceOptions\n\tfor _, opt := range opts {\n\t\topt.applyLocalWorkspaceOption(&optsBag)\n\t}\n\n\t// If the Project is included in the opts, just use that.","sourceCodeStart":1586,"sourceCodeEnd":1622,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/sdk/go/auto/local_workspace.go#L1586-L1622","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Fix the YAML/JSON syntax in the Pulumi.yaml file indicated by the wrapped error","Ensure required fields name, runtime (and main if applicable) are present","Remove or correct unknown/typo'd keys not accepted by the schema","Validate the file against a known-good Pulumi.yaml from a working project","Regenerate the project file (pulumi new) if it is badly corrupted"],"exampleFix":"# before (Pulumi.yaml)\nname: my-project\nruntime:  # empty value\n# after\nname: my-project\nruntime: go","handlingStrategy":"validation","validationCode":"func validatePulumiYaml(dir string) error {\n\tproj, err := workspace.LoadProject(filepath.Join(dir, \"Pulumi.yaml\"))\n\tif err != nil { return err }\n\tif proj.Name == \"\" || proj.Runtime.Name() == \"\" { return errors.New(\"name and runtime required\") }\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":"proj, err := readProjectSettingsFromDir(ctx, workDir)\nif err != nil {\n\tvar loadErr *fs.PathError\n\tif errors.As(err, &loadErr) { /* file missing vs parse error differ */ }\n\treturn err\n}","preventionTips":["Lint Pulumi.yaml with `pulumi config` or a YAML linter before running automation","Keep name and runtime fields present and correctly typed","Avoid mixing JSON content into .yaml files","Test project files against the SDK/CLI version in use"],"tags":["go","automation-api","project-settings","yaml"],"backgroundTag":"invalid-pulumi-yaml","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}