{"record":{"id":"b6c910a8b67c7fe7","repo":"anomalyco/sst","slug":"toml-parsing-error-in-s-w","errorCode":null,"errorMessage":"TOML parsing error in %s: %w","messagePattern":"TOML parsing error in (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/runtime/python/project.go","lineNumber":180,"sourceCode":"\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":162,"sourceCodeEnd":185,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/pkg/runtime/python/project.go#L162-L185","documentation":"parsePyprojectToml throws this when the file was read successfully but BurntSushi/toml could not unmarshal it into pyprojectConfig — i.e. the TOML is syntactically invalid. The file path and the TOML parser error (usually with line/column) are wrapped via %w. This guards against malformed project metadata silently producing an empty config.","triggerScenarios":"pyproject.toml contains a TOML syntax error: unbalanced quotes/brackets, duplicate keys, invalid escape sequences, or non-UTF8 bytes introduced by editing, templating, or a merge conflict.","commonSituations":"Hand-editing pyproject.toml and dropping a closing bracket on [tool.uv.sources]; leftover Git merge-conflict markers (<<<<<<<) in the file; generating TOML with string concatenation in a script; pasting config with smart quotes from docs.","solutions":["Open the wrapped parser error's line/column and fix the TOML syntax at that location.","Validate the file: run `python -m tomllib pyproject.toml` (Python 3.11+) or `uv` to parse it.","Search for merge-conflict markers (<<<<<<<, =======, >>>>>>>) and resolve them.","Regenerate the file from a known-good template or git history: git checkout <ref> -- pyproject.toml."],"exampleFix":"// before (pyproject.toml)\n[project\nname = \"my-app\"\n\n// after\n[project]\nname = \"my-app\"","handlingStrategy":"validation","validationCode":"// shell: validate TOML syntax before deploy\npython3 -c \"import tomllib; tomllib.load(open('pyproject.toml','rb')); print('OK')\"","typeGuard":null,"tryCatchPattern":"try { await deploy() } catch (e) {\n  if (String(e).includes(\"TOML parsing error\"))\n    console.error(\"Fix pyproject.toml syntax at the reported line/column\");\n  throw e;\n}","preventionTips":["Validate pyproject.toml in CI with a TOML parser before deploying.","Avoid hand-concatenating TOML in scripts; use a serializer.","Check for merge-conflict markers after rebasing."],"tags":["python","toml","pyproject","parse-error"],"backgroundTag":"schema-validation-failed","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}