Troubleshooting and FAQ
- Authentication Issues:
- Ensure
LANGFUSE_PUBLIC_KEY
,LANGFUSE_SECRET_KEY
, andLANGFUSE_HOST
(if not using default cloud) are correctly set either as environment variables or in theLangfuse()
constructor. - Use
langfuse.auth_check()
after initialization to verify credentials. Do not use this in production as this method waits for a response from the server.
- Ensure
- No Traces Appearing:
- Check if
tracing_enabled
isTrue
(default). - Verify
sample_rate
is not0.0
. - Ensure
langfuse.shutdown()
is called or the program exits cleanly to allowatexit
hooks to flush data. Manually calllangfuse.flush()
to force data sending. - Enable debug logging (
debug=True
orLANGFUSE_DEBUG="True"
) to see SDK activity and potential errors during exporting.
- Check if
- Incorrect Nesting or Missing Spans:
- If you are self-hosting Langfuse, the Python SDK v3 requires Langfuse platform version >= 3.63.0 for traces to be correctly processed. You can find a snapshot of the legacy v2 SDK documentation here.
- Ensure you are using context managers (
with langfuse.start_as_current_span(...)
) for proper context propagation. - If manually creating spans (
langfuse.start_span()
), ensure they are correctly ended with.end()
. - In async code, ensure context is not lost across
await
boundaries if not using Langfuse’s async-compatible methods.
- Langchain/OpenAI Integration Not Working:
- Confirm the respective integration (e.g.,
from langfuse.openai import openai
orLangfuseCallbackHandler
) is correctly set up before the calls to the LLM libraries are made. - Check for version compatibility issues between Langfuse, Langchain, and OpenAI SDKs.
- Confirm the respective integration (e.g.,
- Media Not Appearing:
- Ensure
LangfuseMedia
objects are correctly initialized and passed ininput
,output
, ormetadata
. - Check debug logs for any media upload errors. Media uploads happen in background threads.
- Ensure
If you encounter persistent issues, please:
- Enable debug logging to gather more information.
- Check the Langfuse status page (if applicable for cloud users).
- Raise an issue on our GitHub repository with details about your setup, SDK version, code snippets, and debug logs.
Was this page helpful?