Skip to content

fix: wrap uv export failures as ImageBuildError with stderr context#1103

Open
EngHabu wants to merge 1 commit into
mainfrom
fix/sentry-3f-uv-export-error
Open

fix: wrap uv export failures as ImageBuildError with stderr context#1103
EngHabu wants to merge 1 commit into
mainfrom
fix/sentry-3f-uv-export-error

Conversation

@EngHabu
Copy link
Copy Markdown
Contributor

@EngHabu EngHabu commented May 22, 2026

Summary

_extract_editables_from_uv_export runs uv export --no-emit-project with check=True and lets CalledProcessError bubble up unmodified during image build. The default message — Command '['uv', 'export', '--no-emit-project']' returned non-zero exit status 2. — drops the captured stderr, which is the only useful piece of information for the user (broken pyproject, lock conflict, etc.).

This change catches CalledProcessError, includes the stderr/stdout the subprocess emitted, and raises it as ImageBuildError so the existing Sentry user-error filter and ClickException handler treat it as user-actionable. Also handles the uv-not-installed case with a pointer to install it instead of leaking FileNotFoundError.

Closes

  • FLYTE-SDK-3FCalledProcessError: Command '['uv', 'export', '--no-emit-project']' returned non-zero exit status 2. from _extract_editables_from_uv_export

fixes FLYTE-SDK-3F

Test plan

  • test_extract_editables_surfaces_uv_export_failure — non-zero exit surfaces stderr inside an ImageBuildError.
  • test_extract_editables_surfaces_missing_uv_binaryFileNotFoundError becomes an ImageBuildError pointing at install docs.
  • Existing test_get_uv_lock_editable_dependencies_resolves_paths still passes (12 tests total).
  • make fmt clean.

🤖 Generated with Claude Code

`_extract_editables_from_uv_export` runs `uv export --no-emit-project` with
`check=True` and let `CalledProcessError` bubble up unmodified during image
build. The default message — `Command '['uv', 'export', '--no-emit-project']'
returned non-zero exit status 2.` — drops the captured stderr, which is the
only useful piece of information (broken pyproject, lock conflict, etc.).

Catch `CalledProcessError`, include the stderr/stdout the subprocess emitted,
and raise as `ImageBuildError` so the existing Sentry user-error filter and
ClickException handler treat it as user-actionable. Also handle the
`uv`-not-installed case with a pointer to install it instead of leaking
`FileNotFoundError`.

Signed-off-by: Haytham Abuelfutuh <haytham@afutuh.com>
@EngHabu EngHabu added the sentry-fix Fix for an issue surfaced by Sentry label May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sentry-fix Fix for an issue surfaced by Sentry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants