anomalyco/sst · error

TOML parsing error in %s: %w

Error message

TOML parsing error in %s: %w

What it means

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.

Source

Thrown at pkg/runtime/python/project.go:180

		srcDir := filepath.Join(pyprojectDir, "src")
		if _, err := os.Stat(srcDir); err == nil {
			return srcDir
		}
		return pyprojectDir
	}
	return projectRoot
}

// parsePyprojectToml reads and parses a pyproject.toml file.
func parsePyprojectToml(path string) (*pyprojectConfig, error) {
	content, err := os.ReadFile(path)
	if err != nil {
		return nil, fmt.Errorf("failed to read pyproject.toml at %s: %w", path, err)
	}

	var config pyprojectConfig
	if err := toml.Unmarshal(content, &config); err != nil {
		return nil, fmt.Errorf("TOML parsing error in %s: %w", path, err)
	}

	return &config, nil
}

View on GitHub (pinned to a0bd20f762)

Solutions

  1. Open the wrapped parser error's line/column and fix the TOML syntax at that location.
  2. Validate the file: run `python -m tomllib pyproject.toml` (Python 3.11+) or `uv` to parse it.
  3. Search for merge-conflict markers (<<<<<<<, =======, >>>>>>>) and resolve them.
  4. Regenerate the file from a known-good template or git history: git checkout <ref> -- pyproject.toml.

Example fix

// before (pyproject.toml)
[project
name = "my-app"

// after
[project]
name = "my-app"
Defensive patterns

Strategy: validation

Validate before calling

// shell: validate TOML syntax before deploy
python3 -c "import tomllib; tomllib.load(open('pyproject.toml','rb')); print('OK')"

Try / catch

try { await deploy() } catch (e) {
  if (String(e).includes("TOML parsing error"))
    console.error("Fix pyproject.toml syntax at the reported line/column");
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30). Data as JSON: /api/errors/b6c910a8b67c7fe7. Report an issue: GitHub.