INNER CODE UNIT · Python
_report_broken_environment
ohdearquant/lionagi · lionagi/cli/main.py:469
def _report_broken_environment(exc: ModuleNotFoundError) -> int:
"""Report a missing import as an environment fault, not a failed run.
A ``ModuleNotFoundError`` reaching the top of the CLI means some import
failed and nothing along the way handled it. Reporting it the way a failed
run is reported tells every caller the wrong thing: the command looks like
it executed and came back empty. That is how a dependency dropping out of an
environment reads downstream as a crashed agent.
Only called once it is established that no run was allocated, which is what
makes the message's claim true rather than merely likely. See ``main``.
The traceback is printed first because it names the import chain and is the
only thing that identifies which package went missing and from where. The
single-line summary goes last so that a caller which keeps only the tail of
stderr still receives the diagnosis rather than the middle of a stack.
"""
traceback.print_exc()