BerriAI/litellm · error · ValueError
LANGFUSE_PUBLIC_KEY and LANGFUSE_SECRET_KEY must be set for…
Error message
LANGFUSE_PUBLIC_KEY and LANGFUSE_SECRET_KEY must be set for Langfuse OpenTelemetry integration.
What it means
Configuration guard for Langfuse OpenTelemetry: one or both of LANGFUSE_PUBLIC_KEY / LANGFUSE_SECRET_KEY are absent from the environment, so an OTEL exporter cannot be authenticated and the config builder refuses to return a partial config.
Solutions
- Set LANGFUSE_PUBLIC_KEY and LANGFUSE_SECRET_KEY environment variables before enabling the Langfuse OpenTelemetry integration.
Example fix
export LANGFUSE_PUBLIC_KEY=pk-lf-... LANGFUSE_SECRET_KEY=sk-lf-...
Defensive patterns
Strategy: validation
When it happens
Trigger: Enabling Langfuse OpenTelemetry export without both required keys set.
Common situations: Only one of the two keys exported, or .env not loaded before proxy start.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/9c031d51e85e53c8.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/integrations/langfuse/langfuse_otel.py:301
"""
Retrieves the Langfuse OpenTelemetry configuration based on environment variables.
Environment Variables:
LANGFUSE_PUBLIC_KEY: Required. Langfuse public key for authentication.
LANGFUSE_SECRET_KEY: Required. Langfuse secret key for authentication.
LANGFUSE_HOST: Optional. Custom Langfuse host URL. Defaults to US cloud.
Returns:
OpenTelemetryConfig: A Pydantic model containing Langfuse OTEL configuration.
Raises:
ValueError: If required keys are missing.
"""
public_key: Final = os.environ.get("LANGFUSE_PUBLIC_KEY", None)
secret_key: Final = os.environ.get("LANGFUSE_SECRET_KEY", None)
if not public_key or not secret_key:
raise ValueError(
"LANGFUSE_PUBLIC_KEY and LANGFUSE_SECRET_KEY must be set for Langfuse OpenTelemetry integration."
)
return LangfuseOtelLogger._build_langfuse_otel_config(
public_key=public_key,
secret_key=secret_key,
langfuse_host=LangfuseOtelLogger._get_langfuse_otel_host(),
)
@staticmethod
def _build_langfuse_otel_config(
public_key: str, secret_key: str, langfuse_host: str | None
) -> "OpenTelemetryConfig":
"""
Builds an OTLP HTTP config pointing at the Langfuse OTEL endpoint for the
given host (US cloud when no host is provided), authorized with the given keys.
"""
if langfuse_host:View on GitHub (pinned to 77b7c6c40c)