BerriAI/litellm · error · ValueError
LEVOAI_WORKSPACE_ID environment variable is required for Lev
Error message
LEVOAI_WORKSPACE_ID environment variable is required for Levo integration.
What it means
Levo integration validation: LEVOAI_WORKSPACE_ID is missing. It becomes the x-levo-workspace-id OTLP header used to scope telemetry to a Levo workspace; absent or empty values abort exporter construction with ValueError.
Source
Thrown at litellm/integrations/levo/levo.py:63
Returns:
LevoConfig: Configuration object containing Levo OTLP settings.
Raises:
ValueError: If required environment variables are missing.
"""
# Required environment variables
api_key: Final = os.environ.get("LEVOAI_API_KEY", None)
org_id: Final = os.environ.get("LEVOAI_ORG_ID", None)
workspace_id: Final = os.environ.get("LEVOAI_WORKSPACE_ID", None)
collector_url: Final = os.environ.get("LEVOAI_COLLECTOR_URL", None)
# Validate required env vars
if not api_key:
raise ValueError("LEVOAI_API_KEY environment variable is required for Levo integration.")
if not org_id:
raise ValueError("LEVOAI_ORG_ID environment variable is required for Levo integration.")
if not workspace_id:
raise ValueError("LEVOAI_WORKSPACE_ID environment variable is required for Levo integration.")
if not collector_url:
raise ValueError(
"LEVOAI_COLLECTOR_URL environment variable is required for Levo integration. "
"Please contact Levo support to get your collector URL."
)
# Use collector URL exactly as provided by the user
endpoint: Final = collector_url
protocol: Final[Protocol] = "otlp_http"
# Build OTLP headers string
# Format: Authorization=Bearer {api_key},x-levo-organization-id={org_id},x-levo-workspace-id={workspace_id}
headers_parts: Final = [f"Authorization=Bearer {api_key}"]
headers_parts.append(f"x-levo-organization-id={org_id}")
headers_parts.append(f"x-levo-workspace-id={workspace_id}")
otlp_auth_headers: Final = ",".join(headers_parts)
View on GitHub (pinned to 6c2dcb801b)
Solutions
- export LEVOAI_WORKSPACE_ID=<workspace id from Levo>
- Verify all LEVOAI_* vars together: 'env | grep LEVOAI'
- Store the full set in one secret/ConfigMap so they deploy atomically
- Remove the levo callback if telemetry is not needed
Example fix
# before # LEVOAI_WORKSPACE_ID unset -> ValueError # after export LEVOAI_API_KEY=... export LEVOAI_ORG_ID=... export LEVOAI_WORKSPACE_ID=ws-1234 export LEVOAI_COLLECTOR_URL=https://...
Defensive patterns
Strategy: validation
Validate before calling
import os
def levo_config_valid() -> bool:
return bool(os.getenv("LEVOAI_WORKSPACE_ID")) Prevention
- Validate all LEVOAI_* vars together at deploy time
- Prefer one ConfigMap/secret object so partial configs cannot ship
When it happens
Trigger: levo callback enabled while LEVOAI_WORKSPACE_ID is not exported; workspace id available in the Levo UI but never copied into the deployment env; a trailing-whitespace or empty value treated as missing.
Common situations: Multi-workspace Levo accounts where the developer picked the right org but forgot the workspace scope; helm values files updated for some LEVOAI_* keys but not all.
Related errors
- LEVOAI_API_KEY environment variable is required for Levo int
- LEVOAI_ORG_ID environment variable is required for Levo inte
- LEVOAI_COLLECTOR_URL environment variable is required for Le
- LANGFUSE_PUBLIC_KEY and LANGFUSE_SECRET_KEY must be set for
- Missing keys={missing_keys} in environment.
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/06ed1a877e269b20.
Report an issue: GitHub.