{"record":{"id":"4f3f0a615dd78915","repo":"anomalyco/sst","slug":"failed-to-read-pyproject-toml-at-s-w","errorCode":null,"errorMessage":"failed to read pyproject.toml at %s: %w","messagePattern":"failed to read pyproject\\.toml at (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/runtime/python/project.go","lineNumber":175,"sourceCode":"\n// resolveSourceRoot determines the source root directory.\nfunc resolveSourceRoot(projectRoot, pyprojectPath string) string {\n\tif pyprojectPath != \"\" {\n\t\tpyprojectDir := filepath.Dir(pyprojectPath)\n\t\tsrcDir := filepath.Join(pyprojectDir, \"src\")\n\t\tif _, err := os.Stat(srcDir); err == nil {\n\t\t\treturn srcDir\n\t\t}\n\t\treturn pyprojectDir\n\t}\n\treturn projectRoot\n}\n\n// parsePyprojectToml reads and parses a pyproject.toml file.\nfunc parsePyprojectToml(path string) (*pyprojectConfig, error) {\n\tcontent, err := os.ReadFile(path)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to read pyproject.toml at %s: %w\", path, err)\n\t}\n\n\tvar config pyprojectConfig\n\tif err := toml.Unmarshal(content, &config); err != nil {\n\t\treturn nil, fmt.Errorf(\"TOML parsing error in %s: %w\", path, err)\n\t}\n\n\treturn &config, nil\n}\n","sourceCodeStart":157,"sourceCodeEnd":185,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/pkg/runtime/python/project.go#L157-L185","documentation":"parsePyprojectToml fails when os.ReadFile cannot read the pyproject.toml at the given path. The path is included in the message and the OS error is wrapped with %w. Callers include findWorkspaceRoot, generateOrCopyRequirementsFile, getWorkspacePackageNames, copyDependencyPackages, discoverBuildablePackages and buildableFromPaths, so this aborts workspace discovery and dependency staging.","triggerScenarios":"pyproject.toml path exists in the resolver's view but reading fails: file deleted between discovery and read, permission denied, path is a directory, or a broken symlink.","commonSituations":"Read-only checkout or CI runner with restrictive file permissions; pyproject.toml is a symlink pointing to a missing file; a directory literally named pyproject.toml from a bad generation script; race with git operations (checkout/clean) during deploy.","solutions":["Read the wrapped %w OS error to identify the precise cause (ENOENT, EACCES, EISDIR).","Fix file permissions: chmod u+r pyproject.toml (and ensure parent dirs are readable).","If it's a symlink or directory, replace it with a real pyproject.toml file.","Re-run the command after any concurrent git/process activity on the repo settles."],"exampleFix":"// before\n$ ls -l pyproject.toml\nlrwxr-xr-x pyproject.toml -> /nonexistent\n\n// after (shell)\n$ rm pyproject.toml && git checkout -- pyproject.toml\n$ chmod u+r pyproject.toml","handlingStrategy":"try-catch","validationCode":"// shell\ntest -f pyproject.toml && test -r pyproject.toml && ! test -d pyproject.toml && echo OK || echo 'pyproject.toml unreadable or not a file'","typeGuard":null,"tryCatchPattern":"try { await deploy() } catch (e) {\n  if (String(e).includes(\"failed to read pyproject.toml\")) {\n    const os = e.cause ?? e; // wrapped %w\n    console.error(\"Fix read error for pyproject.toml:\", os);\n  }\n  throw e;\n}","preventionTips":["Keep pyproject.toml a real regular file with read permissions (chmod u+r).","Avoid symlinks to files outside the checkout.","Don't run concurrent git operations during deploy."],"tags":["python","pyproject","filesystem","file-read"],"backgroundTag":"config-file-read-failed","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}