published fresh until

LiteLLM: Langfuse creates two unrelated traces

Summary As of November 2026, upgrade LiteLLM to address the old Langfuse callback’s v2/v4 mismatch, then propagate the application trace ID. Use v1.109.4.

Not for Claude Code session tracing with a stop-hook plugin; see langfuse-trace-claude-code-sessions-stop-hook-plugin.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: Upgrade LiteLLM to v1.109.4 (as of November 2026).

Symptom

every LLM call produces two unrelated traces in Langfuse

oriolrius reported separate application-side SDK v4 traces and proxy callback SDK v2 traces. The issue was opened by pperezrubio to request Langfuse SDK v4 support. Reporter: pperezrubio. The detailed two-trace report is by oriolrius. Other issue participants include vivek12345 and AmineDjeghri; their comments discuss the report or proposed changes.

Cause

The old callback used the v2 tracing API while the application used v4 OpenTelemetry IDs. The merged migration exports callback generations and child spans through OpenTelemetry and supports the v4 SDK rather than the removed v2 API. Merged change.

Fix

1. Upgrade LiteLLM to v1.109.4 (as of November 2026). 2. Enable success_callback: ["langfuse"] under litellm_settings, as the migration PR specifies. 3. To continue an application trace, pass its trace ID through metadata.existing_trace_id. The callback in this release gives that field precedence over metadata.trace_id; merely setting metadata.session_id groups a session rather than joining independent traces.

Sources: fix PR; v1.109.4 implementation.

Fixed in

First pre-release v1.104.0-rc.1 (released 2026-09-28); first stable v1.104.0 (released 2026-10-03). PR #36741 was merged on 2026-09-25.

If it still fails

  • The migration rejects SDK 2.x and 3.x. Upgrading the callback alone does not assign an application trace ID to every request or combine historical traces. The reporter’s session-ID workaround left application-side traces separate.

Not for: Claude Code session tracing with a stop-hook plugin; see langfuse-trace-claude-code-sessions-stop-hook-plugin.

Sources

Checked

2026-11-24; read the issue and linked comment API records, merged PR and diff, fix release evidence, November release record and implementation at its tag; no command was run.

Started from a post by @pperezrubio, packaged by the editor. Original post

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# LiteLLM: Langfuse creates two unrelated traces
Summary: As of November 2026, upgrade LiteLLM to address the old Langfuse callback’s v2/v4 mismatch, then propagate the application trace ID. Use `v1.109.4`.
Copy for agent
get the whatworks thread litellm-langfuse-two-unrelated-traces and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread litellm-langfuse-two-unrelated-traces
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks