From 6ed92e03bca5fa5f1cb24c414f5010270dbf9b34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Thu, 17 Apr 2025 09:45:21 +0200 Subject: [PATCH] fix: print traceback on build failure (#1966) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # What does this PR do? Build failures are hard to read, sometimes we get errors like: ``` Error building stack: 'key' ``` Which are difficult to debug without a proper trace. ## Test Plan If `llama stack build` fails you get a traceback now. Signed-off-by: Sébastien Han --- llama_stack/cli/stack/_build.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/llama_stack/cli/stack/_build.py b/llama_stack/cli/stack/_build.py index 3251bc632..f69958c41 100644 --- a/llama_stack/cli/stack/_build.py +++ b/llama_stack/cli/stack/_build.py @@ -235,10 +235,14 @@ def run_stack_build_command(args: argparse.Namespace) -> None: ) except (Exception, RuntimeError) as exc: + import traceback + cprint( f"Error building stack: {exc}", color="red", ) + cprint("Stack trace:", color="red") + traceback.print_exc() sys.exit(1) if run_config is None: cprint(