<#1082 fix: wrap docker buildx CalledProcessError ...
# flyte-github
a
#1082 fix: wrap docker buildx CalledProcessError as ImageBuildError Pull request opened by EngHabu Summary Two related fixes in `flyte/_internal/imagebuild/docker_builder.py`: 1.
_build_from_dockerfile
had no try/except around
subprocess.run(..., check=True)
, so a non-zero
docker buildx build -f Dockerfile
exit propagated the raw
subprocess.CalledProcessError
straight up to the caller — and into Sentry as an unhandled SDK crash. 2.
_build_image
already wrapped the same case, but raised a plain
RuntimeError("Failed to build image: ...")
.
RuntimeError
is not in `_is_user_error`'s filter set, so even though docker rejecting the user's Dockerfile/context is purely user-facing feedback, each occurrence landed in Sentry as a crash. Both call sites now wrap the failure as
ImageBuildError
, which is already filtered from Sentry via
_is_user_error
(#1052). The chained
CalledProcessError
is preserved via
raise ... from e
so the diagnostic information remains available. Sentry issues • Fixes FLYTE-SDK-34 (
CalledProcessError: Command '['docker', 'buildx', 'build', '-f', ...]' returned non-zero exit status 1.
) — escaped from
_build_from_dockerfile
• Fixes FLYTE-SDK-2R (
RuntimeError: Failed to build image: Command '['docker', 'buildx', 'build', '--tag', ...]' returned non-zero exit status 1.
) — escaped from
_build_image
Test plan • New
test_build_from_dockerfile_wraps_calledprocesserror_as_image_build_error
regression test • New
test_build_image_wraps_calledprocesserror_as_image_build_error
regression test • Existing
test_ensure_buildx_builder_raises_image_build_error_when_docker_missing
still passes •
make fmt
clean 🤖 Generated with Claude Code flyteorg/flyte-sdk