{"record":{"id":"b74d4653bd5e2181","repo":"anomalyco/sst","slug":"uv-export-failed-w","errorCode":null,"errorMessage":"UV export failed: %w","messagePattern":"UV export failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/runtime/python/build.go","lineNumber":1518,"sourceCode":"\tif cmd.OutputFile != \"\" {\n\t\targs = append(args, \"--output-file=\"+cmd.OutputFile)\n\t}\n\tif cmd.NoEmitWorkspace {\n\t\targs = append(args, \"--no-emit-workspace\")\n\t}\n\tif cmd.NoEditable {\n\t\targs = append(args, \"--no-editable\")\n\t}\n\tif cmd.NoEmitProject {\n\t\targs = append(args, \"--no-emit-project\")\n\t}\n\tif cmd.NoDev {\n\t\targs = append(args, \"--no-dev\")\n\t}\n\n\tresult, err := runUvCommand(ctx, \"uv\", args, cmd.WorkspaceDir)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"UV export failed: %w\", err)\n\t}\n\n\tif !result.Success {\n\t\treturn detailedExportError(result, cmd)\n\t}\n\n\treturn nil\n}\n\n// detailedExportError creates a detailed error message for export failures\nfunc detailedExportError(result *commandResult, cmd *uvExportCommand) error {\n\terrorMsg := fmt.Sprintf(\"UV export failed with exit code %d\", result.ExitCode)\n\n\tif cmd.PackageName != \"\" {\n\t\terrorMsg += fmt.Sprintf(\" (exporting package: %s)\", cmd.PackageName)\n\t}\n\tif cmd.OutputFile != \"\" {\n\t\terrorMsg += fmt.Sprintf(\" to file: %s\", cmd.OutputFile)","sourceCodeStart":1500,"sourceCodeEnd":1536,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/pkg/runtime/python/build.go#L1500-L1536","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"// before (local dev, uv installed via ~/.local/bin not on CI PATH)\n=> UV export failed: exec: \"uv\": executable file not found in $PATH\n// after (CI workflow)\n- run: curl -LsSf https://astral.sh/uv/install.sh | sh\n- run: echo \"$HOME/.local/bin\" >> $GITHUB_PATH","handlingStrategy":"validation","validationCode":"# verify uv and the workspace before running sst deploy\nif ! command -v uv >/dev/null 2>&1; then\n  echo \"uv not found on PATH\"; exit 1\nfi\ncd \"$WORKSPACE_DIR\" && test -f uv.lock && uv export --dry-run >/dev/null","typeGuard":null,"tryCatchPattern":"if err := generateOrCopyRequirementsFile(ctx, cmd); err != nil {\n    if strings.Contains(err.Error(), `executable file not found in $PATH`) {\n        // uv missing: print install instructions\n    }\n    return err\n}","preventionTips":["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"],"tags":["go","uv","python","toolchain","export"],"backgroundTag":"command-not-found","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}