anomalyco/sst · warning

no pyproject.toml found

Error message

no pyproject.toml found

What it means

findPyprojectToml walks up from the handler's directory toward projectRoot looking for a pyproject.toml and returns this error when the climb terminates (filesystem root or leaving projectRoot) without finding one. Note: resolveHandler intentionally ignores this error, so it is only fatal when callers invoke findPyprojectToml directly and require a pyproject.toml.

Source

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

	return candidates
}

// findPyprojectToml searches for pyproject.toml starting from the handler file directory.
func findPyprojectToml(projectRoot, handlerFile string) (string, error) {
	currentDir := filepath.Dir(handlerFile)
	for {
		pyprojectPath := filepath.Join(currentDir, "pyproject.toml")
		if _, err := os.Stat(pyprojectPath); err == nil {
			return pyprojectPath, nil
		}
		parentDir := filepath.Dir(currentDir)
		if parentDir == currentDir || !strings.HasPrefix(currentDir, projectRoot) {
			break
		}
		currentDir = parentDir
	}
	return "", fmt.Errorf("no pyproject.toml found")
}

// resolveSourceRoot determines the source root directory.
func resolveSourceRoot(projectRoot, pyprojectPath string) string {
	if pyprojectPath != "" {
		pyprojectDir := filepath.Dir(pyprojectPath)
		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)

View on GitHub (pinned to a0bd20f762)

Solutions

  1. Add a minimal pyproject.toml at the project (or source) root declaring your package.
  2. Check that pyproject.toml is between the handler file and projectRoot — if it sits above the root, fix the cfgPath/root dir.
  3. If your project legitimately has none, rely on callers (like resolveHandler) that ignore this error and use requirements-based flows.
  4. Verify the file is named exactly pyproject.toml (no typos like pyproject.toml.txt).

Example fix

// before: no pyproject.toml in project

// after: create pyproject.toml at project root
[project]
name = "my-app"
version = "0.1.0"
requires-python = ">=3.11"
Defensive patterns

Strategy: validation

Validate before calling

// shell
cd <project-root> && test -f pyproject.toml && echo OK || echo 'add pyproject.toml between handler file and project root'

Try / catch

try { await deploy() } catch (e) {
  if (String(e).includes("no pyproject.toml found"))
    console.error("Create a pyproject.toml at the project/source root");
  throw e;
}

Prevention

When it happens

Trigger: The handler's file and all ancestor directories up to projectRoot (and the walk's break condition on leaving projectRoot) contain no pyproject.toml — i.e. the Python project has no pyproject.toml between the handler file and the project root.

Common situations: Plain scripts folder with only requirements.txt and no pyproject.toml; pyproject.toml lives ABOVE the resolved projectRoot (wrong cfgPath root); repo migrated from poetry-less setup; handler resolved into a build/ or venv/ copy that lacks metadata files.

Related errors


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