anomalyco/sst · error
UV export failed: %w
Error message
UV export failed: %w
What it means
runUvExport runs `uv export` (with flags like --no-dev when NoDev is set) from cmd.WorkspaceDir to produce a requirements.txt for the function. This error wraps an exec-level failure of the uv process. A non-zero exit code is handled separately via detailedExportError, which adds project-specific hints — so this error means uv could not be run at all.
Source
Thrown at pkg/runtime/python/build.go:1518
if cmd.OutputFile != "" {
args = append(args, "--output-file="+cmd.OutputFile)
}
if cmd.NoEmitWorkspace {
args = append(args, "--no-emit-workspace")
}
if cmd.NoEditable {
args = append(args, "--no-editable")
}
if cmd.NoEmitProject {
args = append(args, "--no-emit-project")
}
if cmd.NoDev {
args = append(args, "--no-dev")
}
result, err := runUvCommand(ctx, "uv", args, cmd.WorkspaceDir)
if err != nil {
return fmt.Errorf("UV export failed: %w", err)
}
if !result.Success {
return detailedExportError(result, cmd)
}
return nil
}
// detailedExportError creates a detailed error message for export failures
func detailedExportError(result *commandResult, cmd *uvExportCommand) error {
errorMsg := fmt.Sprintf("UV export failed with exit code %d", result.ExitCode)
if cmd.PackageName != "" {
errorMsg += fmt.Sprintf(" (exporting package: %s)", cmd.PackageName)
}
if cmd.OutputFile != "" {
errorMsg += fmt.Sprintf(" to file: %s", cmd.OutputFile)View on GitHub (pinned to a0bd20f762)
Solutions
- Install uv and ensure `uv --version` succeeds from the same environment that runs sst deploy
- Verify cmd.WorkspaceDir exists and contains uv.lock/pyproject.toml (cd into it and run `uv export` manually to reproduce)
- Check PATH for the process executing the build (CI containers often have a minimal PATH; export the uv install dir)
- Read the wrapped %w error for the exact OS-level cause (file not found vs permission denied)
- If this appears after a toolchain/manager change (asdf, mise, pyenv), re-shim/reinstall uv for that environment
Example fix
// before (local dev, uv installed via ~/.local/bin not on CI PATH) => UV export failed: exec: "uv": executable file not found in $PATH // after (CI workflow) - run: curl -LsSf https://astral.sh/uv/install.sh | sh - run: echo "$HOME/.local/bin" >> $GITHUB_PATH
Defensive patterns
Strategy: validation
Validate before calling
# verify uv and the workspace before running sst deploy if ! command -v uv >/dev/null 2>&1; then echo "uv not found on PATH"; exit 1 fi cd "$WORKSPACE_DIR" && test -f uv.lock && uv export --dry-run >/dev/null
Try / catch
if err := generateOrCopyRequirementsFile(ctx, cmd); err != nil {
if strings.Contains(err.Error(), `executable file not found in $PATH`) {
// uv missing: print install instructions
}
return err
} Prevention
- Install uv in all environments that run sst (dev machines, CI images, containers)
- Append uv's install directory (~/.local/bin) to PATH in CI before deploying
- Confirm the configured workspace directory exists and contains uv.lock + pyproject.toml
- Reinstall/re-shim uv after switching version managers (mise/asdf/pyenv)
- Run `uv export` manually in the workspace to catch issues before SST packaging
When it happens
Trigger: generateOrCopyRequirementsFile calls runUvExport and runUvCommand returns an error: the uv binary is missing/not on PATH, the workspace directory (cmd.WorkspaceDir) does not exist or is unreadable, or process spawn failed (permissions, resource limits).
Common situations: uv not installed in the CI image or dev container; uv.lock present but uv unavailable; WorkspaceDir pointing at a renamed/missing directory in a monorepo; PATH differences between the user's shell and the process running sst deploy.
Related errors
- uv build failed: %w
- uv build failed (exit code %d): %s
- 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/b74d4653bd5e2181.
Report an issue: GitHub.