acoustic-carpenter-78188
05/11/2026, 4:09 PMflyte deploy / flyte run loads a user's Python module via
ObjectsPerFileGroup.objs, exceptions raised at import time were
propagating up unchanged. The CLI's Sentry wrapper then treated these
user-code bugs (missing imports, broken modules, bad SDK call patterns
at module top-level) as SDK crashes.
This change converts the common user-side import/eval errors --
ImportError, SyntaxError, NameError, AttributeError,
TypeError, ValueError -- into click.ClickException. These
short-circuit the Sentry filter added in #1039 and give the user an
actionable message instead of a stack trace. Other unexpected
exceptions (e.g. RuntimeError) still propagate so real SDK bugs
continue to be reported.
Closes
• FLYTE-SDK-22 -- ValueError: Cannot add additional layers to a non-extendable image raised from user's env.py calling with_pip_packages()
• FLYTE-SDK-23 -- ImportError: cannot import name 'SAMPLING_IMAGE' from user module
• FLYTE-SDK-24 -- ImportError: cannot import name 'find_or_fetch_pdb' from user module
• FLYTE-SDK-26 -- ModuleNotFoundError: No module named 'flytelib.cache' from user module
fixes https://github.com/flyteorg/flyte-sdk/issues/FLYTE-SDK-22
fixes https://github.com/flyteorg/flyte-sdk/issues/FLYTE-SDK-23
fixes https://github.com/flyteorg/flyte-sdk/issues/FLYTE-SDK-24
fixes https://github.com/flyteorg/flyte-sdk/issues/FLYTE-SDK-26
Test plan
• New unit tests in tests/flyte/cli/test_user_module_load.py cover ImportError, ValueError, SyntaxError pass-through of explicit ClickException, and that unrelated RuntimeError still propagates.
• make fmt clean.
🤖 Generated with Claude Code
flyteorg/flyte-sdkacoustic-carpenter-78188
05/11/2026, 5:42 PM