From 72d1c20340681cab2d8e905292af8758aea075c1 Mon Sep 17 00:00:00 2001 From: Sven Geboers Date: Tue, 31 Mar 2026 01:38:30 +0200 Subject: [PATCH] Show error and diagnostics when st.plotly_chart fails instead of silent pass Previously the st.plotly_chart call was wrapped in 'except Exception: pass' which silently swallowed all rendering errors. The user would see no chart and no error message. Now: - Exception message is shown via st.error() - Diagnostics JSON is shown when debug is enabled (EXPLORER_DEBUG_TRAJECTORIES=1 or UI checkbox), even when trace_count > 0 This reveals the actual root cause when the chart fails to render. --- explorer.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/explorer.py b/explorer.py index c68666f..a20f488 100644 --- a/explorer.py +++ b/explorer.py @@ -2096,8 +2096,18 @@ def choose_trajectory_title(axis_def: dict, axis: str, threshold: float = 0.65) else: try: st.plotly_chart(fig, use_container_width=True) - except Exception: - pass + except Exception as e: + st.error(f"Trajectories rendering failed: {e}") + # Always show diagnostics when rendering fails, regardless of trace_count + if get_debug_trajectories_enabled(): + try: + st.json(_last_trajectories_diagnostics) + except Exception: + st.text_area( + "Trajectories diagnostics (JSON failed)", + json.dumps(_last_trajectories_diagnostics, default=str), + height=240, + ) # ---------------------------------------------------------------------------