acoustic-carpenter-78188
06/02/2026, 11:55 PMRuntimeError at import time leaks into the SDK's Sentry project as if it were an SDK crash.
The module loader's two except clauses already wrap (ImportError, SyntaxError, NameError, AttributeError, TypeError, ValueError, KeyError) raised during user-code import as ModuleLoadError — a RuntimeUserError subclass already filtered by flyte/_sentry.py:_is_user_error. But RuntimeError was not in the tuple, so it bubbled straight through.
Fix
Add RuntimeError to both except clauses in src/flyte/_utils/module_loader.py (single-file path and directory path). flyte.errors.ModuleLoadError is still caught first, so SDK-wrapped load errors keep their existing behavior.
Closes
• FLYTE-SDK-46 — RuntimeError: union.sandbox default environments are unavailable — install union-sandbox[deploy] raised at import of union/sandbox/task/_server.py.
fixes FLYTE-SDK-46
Tests
• Extended the test_load_python_modules_single_file_wraps_user_code_errors parametrization with RuntimeError.
• Added test_load_python_modules_single_file_wraps_runtime_error reproducing the FLYTE-SDK-46 shape (a module that raises the union.sandbox message at top level), asserting ModuleLoadError wraps it with the file path and original type.
🤖 Generated with Claude Code
flyteorg/flyte-sdkacoustic-carpenter-78188
06/03/2026, 2:24 PM