anomalyco/sst · error
uv build failed: %w
Error message
uv build failed: %w
What it means
runUvBuild shells out to the `uv` tool (uv build command, via runUvCommand) to build a workspace package defined in pyproject.toml. If the uv process itself fails to start or errors out (not a non-zero exit code, which produces the exit-code variant), this error wraps the exec error. The package cannot be built, so the function's dependencies cannot be assembled.
Source
Thrown at pkg/runtime/python/build.go:1480
if cmd.OutputDir != "" {
args = append(args, "--out-dir="+cmd.OutputDir)
}
args = append(args, "--no-sources")
workingDir := cmd.PackageDir
if workingDir == "" {
workingDir = "."
}
result, err := runUvCommand(ctx, "uv", args, workingDir)
if err != nil {
slog.Error("UV build command failed",
"package", cmd.PackageName,
"command", "uv "+strings.Join(args, " "),
"error", err)
return fmt.Errorf("uv build failed: %w", err)
}
if !result.Success {
return fmt.Errorf("uv build failed (exit code %d): %s", result.ExitCode, result.Stderr)
}
return nil
}
// runUvExport executes a UV export command
func runUvExport(ctx context.Context, cmd *uvExportCommand) error {
args := []string{"export"}
if cmd.AllPackages {
args = append(args, "--all-packages")
} else if cmd.PackageName != "" {
args = append(args, "--package="+cmd.PackageName)
}View on GitHub (pinned to a0bd20f762)
Solutions
- Install uv (curl -LsSf https://astral.sh/uv/install.sh | sh) and confirm `uv --version` works in the same shell/toolchain used to run the build
- Verify the working directory for the build exists (the package dir with pyproject.toml) and contains a valid [build-system] section
- Check that the uv binary is executable and on PATH for the process running the deploy/CI step
- Read the wrapped error and slog output — it logs the exact `uv ...` command that failed
- Build the package manually with `uv build` in the package directory to reproduce the underlying failure
Example fix
// before (CI)
# uv not installed in image
=> uv build failed: exec: "uv": executable file not found in $PATH
// after (Dockerfile)
RUN curl -LsSf https://astral.sh/uv/install.sh | sh
ENV PATH="/root/.local/bin:${PATH}" Defensive patterns
Strategy: validation
Validate before calling
# before building with SST, verify uv is available if ! command -v uv >/dev/null 2>&1; then echo "uv is required but not installed"; exit 1 fi uv --version
Try / catch
if err := buildPackage(ctx, cmd); err != nil {
if strings.Contains(err.Error(), `executable file not found in $PATH`) {
// uv missing: surface install instructions to the user
}
return err
} Prevention
- Install uv (curl -LsSf https://astral.sh/uv/install.sh | sh) in every environment that runs sst deploy/dev
- Pin uv in CI images and Dockerfiles; export its install dir in PATH
- Smoke-test the toolchain with `uv --version` at pipeline start
- Keep package build dirs with valid pyproject.toml present in the repo
When it happens
Trigger: buildPackage invokes runUvBuild for a workspace package and runUvCommand returns an error — typically the `uv` binary is not installed or not on PATH, the working directory is missing, or spawning the process failed (exec.ErrNotFound / permission denied).
Common situations: CI image or dev machine without uv installed; uv not on PATH for the build process (nvm/asdf version manager shims); wrong PATH in container; uv binary present but not executable.
Related errors
- uv build failed (exit code %d): %s
- UV export failed: %w
- uv pip install timed out after 15 minutes - check network co
- failed to run uv pip install: %v %s Function: %s Handler: %
- %s
AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30).
Data as JSON: /api/errors/947e7c420ce431d4.
Report an issue: GitHub.