{"record":{"id":"318e37a8be9dd7c8","repo":"pulumi/pulumi","slug":"can-not-read-s-w","errorCode":null,"errorMessage":"can not read '%s': %w","messagePattern":"can not read '(.+?)': %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdk/go/common/workspace/loaders.go","lineNumber":97,"sourceCode":"\t\t\t\t\tmodifiedConfig[namespacedKey] = value\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tprojectStack[\"config\"] = modifiedConfig\n\t\t\treturn projectStack\n\t\t}\n\t}\n\n\treturn projectStack\n}\n\n// LoadProject reads a project definition from a file.\nfunc LoadProject(path string) (*Project, error) {\n\tcontract.Requiref(path != \"\", \"path\", \"must not be empty\")\n\n\tmarshaller, err := marshallerForPath(path)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"can not read '%s': %w\", path, err)\n\t}\n\n\tb, err := readFileStripUTF8BOM(path)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not read '%s': %w\", path, err)\n\t}\n\n\treturn LoadProjectBytes(b, path, marshaller)\n}\n\n// LoadProjectBytes reads a project definition from a byte slice.\nfunc LoadProjectBytes(b []byte, path string, marshaller encoding.Marshaler) (*Project, error) {\n\tvar raw any\n\terr := marshaller.Unmarshal(b, &raw)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not unmarshal '%s': %w\", path, err)\n\t}\n","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/sdk/go/common/workspace/loaders.go#L79-L115","documentation":"LoadProject in sdk/go/common/workspace/loaders.go returns this error when marshallerForPath fails — i.e. the file's extension does not map to a supported marshaller (YAML/JSON). Despite the 'can not read' wording, it is raised before the file is actually read; the wrapped error explains why no marshaller could be chosen. Note the confusing similarity with the later 'could not read' message, which covers actual file I/O.","triggerScenarios":"Calling workspace.LoadProject(path) with a file whose extension is not .yaml/.yml/.json (e.g. Pulumipack or a .txt project file), or marshallerForPath returning an unsupported-format error.","commonSituations":"Renaming Pulumi.yaml to Pulumi.yml2 or an unusual extension; pointing LoadProject at a directory or config file with no recognized extension; tooling generating project files with the wrong suffix.","solutions":["Rename the project file to a supported name: Pulumi.yaml, Pulumi.yml, or Pulumi.json.","Check the wrapped error to confirm it is an unsupported-format issue rather than permissions.","Pass a path with a recognized extension if calling LoadProgram-like helpers programmatically.","Inspect the directory listing: the file may be misspelled (e.g. Pulimai.yaml)."],"exampleFix":"// before\nproj, err := workspace.LoadProject(\"Pulumi.PUL.yml.orig\")\n// after\nproj, err := workspace.LoadProject(\"Pulumi.yaml\")","handlingStrategy":"validation","validationCode":"ext := strings.ToLower(filepath.Ext(path))\nswitch ext {\ncase \".yaml\", \".yml\", \".json\":\n    // ok\ndefault:\n    return fmt.Errorf(\"%s has unsupported extension %q; use .yaml/.yml/.json\", path, ext)\n}","typeGuard":null,"tryCatchPattern":"proj, err := workspace.LoadProject(path)\nif err != nil {\n    if strings.HasPrefix(err.Error(), \"can not read '\") {\n        return fmt.Errorf(\"unsupported project format for %s: %w\", path, err)\n    }\n    return err\n}","preventionTips":["Keep project files named Pulumi.yaml, Pulumi.yml, or Pulumi.json.","Don't rename or template-substitute project files to new extensions.","List the directory before loading to confirm the exact filename and spelling.","Generate projects with pulumi new/convert rather than ad-hoc scripts."],"tags":["go","config","project-file","file-format"],"backgroundTag":"unsupported-project-file-format","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}