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
- Add a minimal pyproject.toml at the project (or source) root declaring your package.
- Check that pyproject.toml is between the handler file and projectRoot — if it sits above the root, fix the cfgPath/root dir.
- If your project legitimately has none, rely on callers (like resolveHandler) that ignore this error and use requirements-based flows.
- 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
- Always include a pyproject.toml in Python projects deployed with this runtime.
- Ensure the cfgPath root does not exclude the directory containing pyproject.toml.
- Keep the file at the source root, not in a nested build copy.
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
- failed to read pyproject.toml at %s: %w
- TOML parsing error in %s: %w
- default Python Dockerfile not found at %s: %w
- failed to find package archive: %w
- no package archive found for %s (tried patterns: %s-*.whl, %
AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30).
Data as JSON: /api/errors/d3df56da969d9305.
Report an issue: GitHub.