BerriAI/litellm · error · ValueError
WANDB_API_KEY must be set for Weave OpenTelemetry…
Error message
WANDB_API_KEY must be set for Weave OpenTelemetry integration.
What it means
Configuration guard for Weave OpenTelemetry: WANDB_API_KEY is not set in the environment, so the OTEL exporter cannot authenticate to W&B and the config builder raises rather than returning an unusable config.
Solutions
- Set the WANDB_API_KEY environment variable before enabling the Weave OpenTelemetry integration.
Example fix
export WANDB_API_KEY=...
Defensive patterns
Strategy: validation
When it happens
Trigger: Enabling Weave OpenTelemetry export without WANDB_API_KEY set.
Common situations: Env var not exported or wandb auth not completed on the host.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/4ea2e9f3e6772bc5.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/integrations/weave/weave_otel.py:139
Retrieves the Weave OpenTelemetry configuration based on environment variables.
Environment Variables:
WANDB_API_KEY: Required. W&B API key for authentication.
WANDB_PROJECT_ID: Required. Project ID in format <entity>/<project_name>.
WANDB_HOST: Optional. Custom Weave host URL. Defaults to cloud endpoint.
Returns:
WeaveOtelConfig: A Pydantic model containing Weave OTEL configuration.
Raises:
ValueError: If required environment variables are missing.
"""
api_key: Final = os.getenv("WANDB_API_KEY")
project_id: Final = os.getenv("WANDB_PROJECT_ID")
host = os.getenv("WANDB_HOST")
if not api_key:
raise ValueError("WANDB_API_KEY must be set for Weave OpenTelemetry integration.")
if not project_id:
raise ValueError(
"WANDB_PROJECT_ID must be set for Weave OpenTelemetry integration. Format: <entity>/<project_name>"
)
if host:
if not host.startswith("http"):
host = "https://" + host
# Self-managed instances use a different path
endpoint = host.rstrip("/") + WEAVE_OTEL_ENDPOINT
verbose_logger.debug("Using Weave OTEL endpoint from host: %s", endpoint)
else:
endpoint = WEAVE_BASE_URL + WEAVE_OTEL_ENDPOINT
verbose_logger.debug("Using Weave cloud endpoint: %s", endpoint)
# Weave uses Basic auth with format: api:<WANDB_API_KEY>
auth_header: Final = _get_weave_authorization_header(api_key=api_key)View on GitHub (pinned to 77b7c6c40c)