BerriAI/litellm · error · ValueError
endpoint not set for GenericAPILogger…
Error message
endpoint not set for GenericAPILogger, GENERIC_LOGGER_ENDPOINT not found in environment variables
What it means
GenericAPILogger.__init__ raises ValueError when no endpoint was provided and GENERIC_LOGGER_ENDPOINT is unset. GenericAPILogger posts log events to an arbitrary HTTP endpoint; without one there is nowhere to send data, so construction fails fast.
Solutions
- Pass endpoint explicitly: GenericAPILogger(endpoint='https://logs.example.com/ingest', ...).
- Or set GENERIC_LOGGER_ENDPOINT in the environment before the proxy starts.
- Double-check spelling: it is GENERIC_LOGGER_ENDPOINT, not GENERIC_API_LOGGER_ENDPOINT.
- Add the env var to your deployment manifest (compose/k8s) once and reuse across environments.
Example fix
# before GenericAPILogger() # no env var -> ValueError # after GenericAPILogger(endpoint='https://logs.example.com/ingest')
Defensive patterns
Strategy: validation
Validate before calling
import os
endpoint = endpoint or os.getenv('GENERIC_LOGGER_ENDPOINT')
if endpoint is None:
raise SystemExit('GENERIC_LOGGER_ENDPOINT env var or endpoint= arg is required for GenericAPILogger') Type guard
def generic_logger_endpoint_set() -> bool:
return os.getenv('GENERIC_LOGGER_ENDPOINT') is not None Try / catch
try:
GenericAPILogger()
except ValueError as e:
if 'GENERIC_LOGGER_ENDPOINT' in str(e):
raise ConfigError('Set GENERIC_LOGGER_ENDPOINT or pass endpoint=') from e
raise Prevention
- Prefer passing endpoint explicitly in code over relying on ambient env vars.
- Add GENERIC_LOGGER_ENDPOINT to your environment template with a placeholder comment.
When it happens
Trigger: Instantiating GenericAPILogger(...) without endpoint= in an environment lacking GENERIC_LOGGER_ENDPOINT; env var defined in .env.local but the process runs from another environment; callback loaded via config.yaml where the endpoint field didn't map to the constructor argument.
Common situations: Switching from another HTTP logging callback and assuming the endpoint comes from callback config YAML; deploying to staging/prod where the env var was never added; renaming the env var between litellm versions.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- AZURE_SENTINEL_CLIENT_ID or AZURE_CLIENT_ID is required…
- AZURE_SENTINEL_CLIENT_SECRET or AZURE_CLIENT_SECRET is…
- AZURE_SENTINEL_DCR_IMMUTABLE_ID is required. Set it as an…
- AZURE_SENTINEL_ENDPOINT is required. Set it as an…
- AZURE_SENTINEL_TENANT_ID or AZURE_TENANT_ID is required…
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/b2a21c8e00330628.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/integrations/generic_api/generic_api_callback.py:157
headers[key] = substitute_env_variables(value)
if event_types is None and "event_types" in callback_config:
event_types = callback_config["event_types"]
if log_format is None and "log_format" in callback_config:
log_format = callback_config["log_format"]
else:
verbose_logger.warning(
"callback_name '%s' not found in generic_api_compatible_callbacks.json", callback_name
)
#########################################################
# Init httpx client
#########################################################
self.async_httpx_client = get_async_httpx_client(llm_provider=httpxSpecialProvider.LoggingCallback)
endpoint = endpoint or os.getenv("GENERIC_LOGGER_ENDPOINT")
if endpoint is None:
raise ValueError(
"endpoint not set for GenericAPILogger, GENERIC_LOGGER_ENDPOINT not found in environment variables"
)
self.headers: dict[str, str] = self._get_headers(headers)
self.endpoint: str = endpoint
self.event_types: list[API_EVENT_TYPES] | None = event_types
self.callback_name: str | None = callback_name
self.max_retries = max(0, int(max_retries or 0))
retry_delay_value: Final = 0.0 if retry_delay is None else retry_delay
self.retry_delay = max(0.0, float(retry_delay_value))
self.timeout = timeout
# Validate and store log_format
if log_format is not None and log_format not in [
"json_array",
"ndjson",
"single",
]:View on GitHub (pinned to 77b7c6c40c)