From 04877ec014c8d4d3772c87f1f605a0b0cb83dcd3 Mon Sep 17 00:00:00 2001 From: Hassieb Pakzad <68423100+hassiebp@users.noreply.github.com> Date: Tue, 11 Nov 2025 10:30:14 +0100 Subject: [PATCH] fix(client): handle update_current_trace on non recorded spans gracefully --- langfuse/_client/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/langfuse/_client/client.py b/langfuse/_client/client.py index 55a9667e3..ae5eba235 100644 --- a/langfuse/_client/client.py +++ b/langfuse/_client/client.py @@ -1664,7 +1664,7 @@ def update_current_trace( current_otel_span = self._get_current_otel_span() - if current_otel_span is not None: + if current_otel_span is not None and current_otel_span.is_recording(): existing_observation_type = current_otel_span.attributes.get( # type: ignore[attr-defined] LangfuseOtelSpanAttributes.OBSERVATION_TYPE, "span" )