---
title: Troubleshooting & FAQ
description: Resolve common Python and JS/TS SDK issues with side-by-side guidance.
category: SDKs
---

# Troubleshooting & FAQ

If you cannot find your issue below, try [Ask AI](/docs/ask-ai), open a [GitHub issue](/issues), or contact [support](/support).

## Authentication issues

- Ensure `LANGFUSE_PUBLIC_KEY`, `LANGFUSE_SECRET_KEY`, and `LANGFUSE_BASE_URL` are set as environment variables or passed to `Langfuse()` as constructor arguments.
- Use `langfuse.auth_check()` during setup (not in production) to confirm connectivity.

## No traces appearing

- See [Missing traces](/faq/all/missing-traces) for common reasons and solutions.
- Confirm `tracing_enabled` is `True` and `sample_rate` is not `0.0`.
- Call `langfuse.shutdown()` (or `langfuse.flush()` in short-lived jobs) so queued data is exported.
- Enable debug logging (`debug=True` or `LANGFUSE_DEBUG="True"` on Python, `LANGFUSE_DEBUG="true"` or `LANGFUSE_LOG_LEVEL="DEBUG"` on JS/TS) to inspect exporter output.

## Incorrect nesting or missing spans

- Self-hosted users need Langfuse platform **>= 3.63.0** for the OTel based SDKs.
- Prefer context managers (`with langfuse.start_as_current_observation(...)`) to maintain OTEL context.
- If using manual spans (`langfuse.start_observation()`), always call `.end()`.
- In async code, rely on Langfuse helpers to avoid losing context across `await` boundaries.
- If an observation references a parent that Langfuse never received, it is shown at the trace root instead of under its intended parent. This can happen when the parent was filtered out, dropped, or never sent, so make sure every referenced parent observation is actually exported.

## LangChain/OpenAI integration issues

- Ensure Langfuse wrappers (`from langfuse.openai import openai` or `LangfuseCallbackHandler`) are instantiated before API calls.
- Check version compatibility between Langfuse, LangChain, and the model SDKs.

## Media not appearing

- Use `LangfuseMedia` objects for audio/image payloads and inspect debug logs to surface upload errors (uploads run on background threads).

## Missing traces with `@vercel/otel`

- Make sure you are on `@vercel/otel` v2 or later. Versions before v2 were built on the OpenTelemetry JS SDK v1 and could not pick up the `LangfuseSpanProcessor`, which is built on the OpenTelemetry JS SDK v2 ([vercel/otel#154](https://github.com/vercel/otel/issues/154)). With `@vercel/otel` v2+, `registerOTel({ spanProcessors: [new LangfuseSpanProcessor()] })` exports traces as expected.
- Alternatively, use the manual OpenTelemetry setup via `NodeSDK` and register the `LangfuseSpanProcessor`. See the [TypeScript instrumentation docs](/docs/observability/sdk/instrumentation#framework-third-party-telemetry) for a full example.

<!-- agent-instructions -->

---

## Agent Instructions

This page is part of the [Langfuse](https://langfuse.com) documentation, published as plain Markdown for AI agents. Every page is available as Markdown by appending `.md` to its URL, or by sending an `Accept: text/markdown` header. This page: `https://langfuse.com/docs/observability/sdk/troubleshooting-and-faq.md`.

### Querying these docs

If the answer is not on this page, query the documentation instead of guessing:

- **Semantic search** across all Langfuse docs, returning an answer with the relevant pages and excerpts. Ask a specific, self-contained question:

  ```bash
  curl -sG "https://langfuse.com/api/search-docs" --data-urlencode "query=How do I trace a LangGraph agent?"
  ```

- **Index of every page**: <https://langfuse.com/llms.txt>, with per-section indexes [llms-docs.txt](https://langfuse.com/llms-docs.txt), [llms-integrations.txt](https://langfuse.com/llms-integrations.txt), and [llms-self-hosting.txt](https://langfuse.com/llms-self-hosting.txt).

### Before writing Langfuse code

- **Install the [Langfuse Agent Skill](https://langfuse.com/docs/api-and-data-platform/features/agent-skill).** It encodes Langfuse's own best practices for instrumentation, prompt management, and evaluation, and materially improves results.
- **Read [What does a good trace look like?](https://langfuse.com/docs/observability/best-practices.md)** before instrumenting an application.
- **Verify endpoints, parameters, and response fields** against the [API reference](https://api.reference.langfuse.com) instead of inferring them from code examples.
- **Use the [Langfuse CLI](https://langfuse.com/docs/api-and-data-platform/features/cli)** (`npx langfuse-cli api <resource> <action>`) to read or write traces, prompts, datasets, and scores from the terminal.

Found an error in these docs? Please open an issue at <https://github.com/langfuse/langfuse-docs/issues>.
