litellm - ✅(Solved) Fix [Bug]: Langfuse telemetry fails with `AttributeError: 'NoneType' object has no attribute 'get'` in v1.83 [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#25940Fetched 2026-04-18 05:53:00
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Participants
Timeline (top)
cross-referenced ×1labeled ×1referenced ×1

Starting in v1.83, all Langfuse success callbacks silently fail with an AttributeError. No traces are sent to Langfuse. The error is non-blocking so LLM calls still succeed, making this hard to detect without log monitoring.

Error Message

Langfuse Layer Error - Exception occurred while logging success event:
'NoneType' object has no attribute 'get'

Traceback (most recent call last):
  File "litellm/integrations/langfuse/langfuse_prompt_management.py", line 307, in async_log_success_event
    langfuse_logger_to_use = LangFuseHandler.get_langfuse_logger_for_request(
        globalLangfuseLogger=self,
        standard_callback_dynamic_params=standard_callback_dynamic_params,
        in_memory_dynamic_logger_cache=in_memory_dynamic_logger_cache,
    )
  File "litellm/integrations/langfuse/langfuse_handler.py", line 40, in get_langfuse_logger_for_request
    LangFuseHandler._dynamic_langfuse_credentials_are_passed(
        standard_callback_dynamic_params
    )
  File "litellm/integrations/langfuse/langfuse_handler.py", line 164, in _dynamic_langfuse_credentials_are_passed
    standard_callback_dynamic_params.get("langfuse_host") is not None
AttributeError: 'NoneType' object has no attribute 'get'

Root Cause

In langfuse_handler.py, _dynamic_langfuse_credentials_are_passed() calls .get() on standard_callback_dynamic_params without a null check. When no per-request dynamic params are passed (the standard case where credentials come from env vars), this argument is None instead of {}, causing the crash.

# langfuse_handler.py:164 — crashes when standard_callback_dynamic_params is None
standard_callback_dynamic_params.get("langfuse_host") is not None

Fix Action

Fix

# Add a None guard
(standard_callback_dynamic_params or {}).get("langfuse_host") is not None

PR fix notes

PR #25941: fix(langfuse): guard against None standard_callback_dynamic_params

Description (problem / solution / changelog)

Summary

_dynamic_langfuse_credentials_are_passed() now returns False immediately when standard_callback_dynamic_params is None, preventing the AttributeError that caused all Langfuse success callbacks to silently fail when credentials were supplied via environment variables.

Closes #25940

Relevant issues

Fixes #25940

Pre-Submission checklist

  • I have Added testing in the tests/test_litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

Screenshots / Proof of Fix

Before (v1.83.x) — every LLM call logs this error and no traces reach Langfuse:

{"message": "Langfuse Layer Error - Exception occurred while logging success event: 'NoneType' object has no attribute 'get'",
 "level": "ERROR", ...}

After_dynamic_langfuse_credentials_are_passed(None) returns False, the global env-var logger is used, and traces are sent normally.

Type

🐛 Bug Fix

Changes

  • litellm/integrations/langfuse/langfuse_handler.py — added early None guard in _dynamic_langfuse_credentials_are_passed() so it returns False instead of raising AttributeError when called without per-request dynamic params.
  • tests/test_litellm/integrations/langfuse/test_langfuse_handler.py — 6 new unit tests covering None, empty dict, and all four credential keys.

Changed files

  • litellm/integrations/langfuse/langfuse_handler.py (modified, +4/-3)
  • tests/test_litellm/integrations/langfuse/test_langfuse_handler.py (added, +39/-0)

Code Example

Langfuse Layer Error - Exception occurred while logging success event:
'NoneType' object has no attribute 'get'

Traceback (most recent call last):
  File "litellm/integrations/langfuse/langfuse_prompt_management.py", line 307, in async_log_success_event
    langfuse_logger_to_use = LangFuseHandler.get_langfuse_logger_for_request(
        globalLangfuseLogger=self,
        standard_callback_dynamic_params=standard_callback_dynamic_params,
        in_memory_dynamic_logger_cache=in_memory_dynamic_logger_cache,
    )
  File "litellm/integrations/langfuse/langfuse_handler.py", line 40, in get_langfuse_logger_for_request
    LangFuseHandler._dynamic_langfuse_credentials_are_passed(
        standard_callback_dynamic_params
    )
  File "litellm/integrations/langfuse/langfuse_handler.py", line 164, in _dynamic_langfuse_credentials_are_passed
    standard_callback_dynamic_params.get("langfuse_host") is not None
AttributeError: 'NoneType' object has no attribute 'get'

---

# langfuse_handler.py:164 — crashes when standard_callback_dynamic_params is None
standard_callback_dynamic_params.get("langfuse_host") is not None

---

# Add a None guard
(standard_callback_dynamic_params or {}).get("langfuse_host") is not None

---

envVars:
  LANGFUSE_PUBLIC_KEY: "pk-lf-..."
  LANGFUSE_SECRET_KEY: "sk-lf-..."
  LANGFUSE_HOST: "http://langfuse-web.langfuse.svc.cluster.local:3000"

---

litellm_settings:
  success_callback:
    - langfuse

---

{"message": "Langfuse Layer Error - Exception occurred while logging success event: 'NoneType' object has no attribute 'get'", "level": "ERROR", "timestamp": "2026-04-17T01:13:25.885046", "stacktrace": "Traceback (most recent call last):\n  File \"/usr/lib/python3.13/site-packages/litellm/litellm_core_utils/asyncify.py\", line 107, in run_async_function\n    _ = asyncio.get_running_loop()\nRuntimeError: no running event loop\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/usr/lib/python3.13/site-packages/litellm/integrations/langfuse/langfuse_prompt_management.py\", line 307, in async_log_success_event\n    langfuse_logger_to_use = LangFuseHandler.get_langfuse_logger_for_request(\n        globalLangfuseLogger=self,\n        standard_callback_dynamic_params=standard_callback_dynamic_params,\n        in_memory_dynamic_logger_cache=in_memory_dynamic_logger_cache,\n    )\n  File \"/usr/lib/python3.13/site-packages/litellm/integrations/langfuse/langfuse_handler.py\", line 40, in get_langfuse_logger_for_request\n    LangFuseHandler._dynamic_langfuse_credentials_are_passed(\n    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^\n        standard_callback_dynamic_params\n        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n    )\n    ^\n  File \"/usr/lib/python3.13/site-packages/litellm/integrations/langfuse/langfuse_handler.py\", line 164, in _dynamic_langfuse_credentials_are_passed\n    standard_callback_dynamic_params.get(\"langfuse_host\") is not None\n    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nAttributeError: 'NoneType' object has no attribute 'get'"}
{"message": "Langfuse Layer Error - Exception occurred while logging success event: 'NoneType' object has no attribute 'get'", "level": "ERROR", "timestamp": "2026-04-17T01:13:25.889899", "stacktrace": "Traceback (most recent call last):\n  File \"/usr/lib/python3.13/site-packages/litellm/integrations/langfuse/langfuse_prompt_management.py\", line 307, in async_log_success_event\n    langfuse_logger_to_use = LangFuseHandler.get_langfuse_logger_for_request(\n        globalLangfuseLogger=self,\n        standard_callback_dynamic_params=standard_callback_dynamic_params,\n        in_memory_dynamic_logger_cache=in_memory_dynamic_logger_cache,\n    )\n  File \"/usr/lib/python3.13/site-packages/litellm/integrations/langfuse/langfuse_handler.py\", line 40, in get_langfuse_logger_for_request\n    LangFuseHandler._dynamic_langfuse_credentials_are_passed(\n    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^\n        standard_callback_dynamic_params\n        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n    )\n    ^\n  File \"/usr/lib/python3.13/site-packages/litellm/integrations/langfuse/langfuse_handler.py\", line 164, in _dynamic_langfuse_credentials_are_passed\n    standard_callback_dynamic_params.get(\"langfuse_host\") is not None\n    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nAttributeError: 'NoneType' object has no attribute 'get'"}
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

What happened?

Description

Starting in v1.83, all Langfuse success callbacks silently fail with an AttributeError. No traces are sent to Langfuse. The error is non-blocking so LLM calls still succeed, making this hard to detect without log monitoring.

Version

  • Broken: v1.83.3-stable (and likely all v1.83.x)
  • Working: v1.81.12

Error

Langfuse Layer Error - Exception occurred while logging success event:
'NoneType' object has no attribute 'get'

Traceback (most recent call last):
  File "litellm/integrations/langfuse/langfuse_prompt_management.py", line 307, in async_log_success_event
    langfuse_logger_to_use = LangFuseHandler.get_langfuse_logger_for_request(
        globalLangfuseLogger=self,
        standard_callback_dynamic_params=standard_callback_dynamic_params,
        in_memory_dynamic_logger_cache=in_memory_dynamic_logger_cache,
    )
  File "litellm/integrations/langfuse/langfuse_handler.py", line 40, in get_langfuse_logger_for_request
    LangFuseHandler._dynamic_langfuse_credentials_are_passed(
        standard_callback_dynamic_params
    )
  File "litellm/integrations/langfuse/langfuse_handler.py", line 164, in _dynamic_langfuse_credentials_are_passed
    standard_callback_dynamic_params.get("langfuse_host") is not None
AttributeError: 'NoneType' object has no attribute 'get'

Root Cause

In langfuse_handler.py, _dynamic_langfuse_credentials_are_passed() calls .get() on standard_callback_dynamic_params without a null check. When no per-request dynamic params are passed (the standard case where credentials come from env vars), this argument is None instead of {}, causing the crash.

# langfuse_handler.py:164 — crashes when standard_callback_dynamic_params is None
standard_callback_dynamic_params.get("langfuse_host") is not None

Fix

# Add a None guard
(standard_callback_dynamic_params or {}).get("langfuse_host") is not None

Configuration

Langfuse configured via environment variables (no per-request dynamic params):

envVars:
  LANGFUSE_PUBLIC_KEY: "pk-lf-..."
  LANGFUSE_SECRET_KEY: "sk-lf-..."
  LANGFUSE_HOST: "http://langfuse-web.langfuse.svc.cluster.local:3000"
litellm_settings:
  success_callback:
    - langfuse

Steps to Reproduce

  1. Configure Langfuse via env vars (LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY, LANGFUSE_HOST)
  2. Add langfuse to litellm_settings.callbacks
  3. Make any LLM request
  4. Observe: Langfuse Layer Error in logs, no traces appear in Langfuse

Expected Behavior

Traces are sent to Langfuse for every successful LLM call.

Actual Behavior

Every success callback throws AttributeError, traces are dropped silently.

Relevant log output

{"message": "Langfuse Layer Error - Exception occurred while logging success event: 'NoneType' object has no attribute 'get'", "level": "ERROR", "timestamp": "2026-04-17T01:13:25.885046", "stacktrace": "Traceback (most recent call last):\n  File \"/usr/lib/python3.13/site-packages/litellm/litellm_core_utils/asyncify.py\", line 107, in run_async_function\n    _ = asyncio.get_running_loop()\nRuntimeError: no running event loop\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/usr/lib/python3.13/site-packages/litellm/integrations/langfuse/langfuse_prompt_management.py\", line 307, in async_log_success_event\n    langfuse_logger_to_use = LangFuseHandler.get_langfuse_logger_for_request(\n        globalLangfuseLogger=self,\n        standard_callback_dynamic_params=standard_callback_dynamic_params,\n        in_memory_dynamic_logger_cache=in_memory_dynamic_logger_cache,\n    )\n  File \"/usr/lib/python3.13/site-packages/litellm/integrations/langfuse/langfuse_handler.py\", line 40, in get_langfuse_logger_for_request\n    LangFuseHandler._dynamic_langfuse_credentials_are_passed(\n    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^\n        standard_callback_dynamic_params\n        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n    )\n    ^\n  File \"/usr/lib/python3.13/site-packages/litellm/integrations/langfuse/langfuse_handler.py\", line 164, in _dynamic_langfuse_credentials_are_passed\n    standard_callback_dynamic_params.get(\"langfuse_host\") is not None\n    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nAttributeError: 'NoneType' object has no attribute 'get'"}
{"message": "Langfuse Layer Error - Exception occurred while logging success event: 'NoneType' object has no attribute 'get'", "level": "ERROR", "timestamp": "2026-04-17T01:13:25.889899", "stacktrace": "Traceback (most recent call last):\n  File \"/usr/lib/python3.13/site-packages/litellm/integrations/langfuse/langfuse_prompt_management.py\", line 307, in async_log_success_event\n    langfuse_logger_to_use = LangFuseHandler.get_langfuse_logger_for_request(\n        globalLangfuseLogger=self,\n        standard_callback_dynamic_params=standard_callback_dynamic_params,\n        in_memory_dynamic_logger_cache=in_memory_dynamic_logger_cache,\n    )\n  File \"/usr/lib/python3.13/site-packages/litellm/integrations/langfuse/langfuse_handler.py\", line 40, in get_langfuse_logger_for_request\n    LangFuseHandler._dynamic_langfuse_credentials_are_passed(\n    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^\n        standard_callback_dynamic_params\n        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n    )\n    ^\n  File \"/usr/lib/python3.13/site-packages/litellm/integrations/langfuse/langfuse_handler.py\", line 164, in _dynamic_langfuse_credentials_are_passed\n    standard_callback_dynamic_params.get(\"langfuse_host\") is not None\n    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nAttributeError: 'NoneType' object has no attribute 'get'"}

What part of LiteLLM is this about?

No response

What LiteLLM version are you on ?

v1.83.3-stable

Twitter / LinkedIn details

No response

extent analysis

TL;DR

The most likely fix is to add a null check for standard_callback_dynamic_params in the _dynamic_langfuse_credentials_are_passed function to prevent the AttributeError.

Guidance

  1. Verify the issue: Confirm that the error occurs when standard_callback_dynamic_params is None by checking the logs for the AttributeError message.
  2. Apply the fix: Update the _dynamic_langfuse_credentials_are_passed function to include a null check, as shown in the provided fix: (standard_callback_dynamic_params or {}).get("langfuse_host") is not None.
  3. Test the fix: After applying the fix, make an LLM request and verify that the Langfuse Layer Error is no longer present in the logs and that traces are being sent to Langfuse.
  4. Review configuration: Ensure that Langfuse is configured correctly via environment variables and that langfuse is added to litellm_settings.callbacks.

Example

The fix can be applied by updating the langfuse_handler.py file with the following code:

# langfuse_handler.py:164 — fixed code
(standard_callback_dynamic_params or {}).get("langfuse_host") is not None

Notes

This fix assumes that the issue is caused by the missing null check in the _dynamic_langfuse_credentials_are_passed function. If the issue persists after applying the fix, further debugging may be necessary.

Recommendation

Apply the workaround by adding the null check to the _dynamic_langfuse_credentials_are_passed function, as this is a straightforward fix that addresses the identified root cause of the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING