{"record":{"id":"b2a21c8e00330628","repo":"BerriAI/litellm","slug":"endpoint-not-set-for-genericapilogger-generic-log","errorCode":null,"errorMessage":"endpoint not set for GenericAPILogger, GENERIC_LOGGER_ENDPOINT not found in environment variables","messagePattern":"endpoint not set for GenericAPILogger, GENERIC_LOGGER_ENDPOINT not found in environment variables","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/generic_api/generic_api_callback.py","lineNumber":157,"sourceCode":"                                headers[key] = substitute_env_variables(value)\n\n                    if event_types is None and \"event_types\" in callback_config:\n                        event_types = callback_config[\"event_types\"]\n\n                    if log_format is None and \"log_format\" in callback_config:\n                        log_format = callback_config[\"log_format\"]\n            else:\n                verbose_logger.warning(\n                    \"callback_name '%s' not found in generic_api_compatible_callbacks.json\", callback_name\n                )\n\n        #########################################################\n        # Init httpx client\n        #########################################################\n        self.async_httpx_client = get_async_httpx_client(llm_provider=httpxSpecialProvider.LoggingCallback)\n        endpoint = endpoint or os.getenv(\"GENERIC_LOGGER_ENDPOINT\")\n        if endpoint is None:\n            raise ValueError(\n                \"endpoint not set for GenericAPILogger, GENERIC_LOGGER_ENDPOINT not found in environment variables\"\n            )\n\n        self.headers: dict[str, str] = self._get_headers(headers)\n        self.endpoint: str = endpoint\n        self.event_types: list[API_EVENT_TYPES] | None = event_types\n        self.callback_name: str | None = callback_name\n        self.max_retries = max(0, int(max_retries or 0))\n        retry_delay_value: Final = 0.0 if retry_delay is None else retry_delay\n        self.retry_delay = max(0.0, float(retry_delay_value))\n        self.timeout = timeout\n\n        # Validate and store log_format\n        if log_format is not None and log_format not in [\n            \"json_array\",\n            \"ndjson\",\n            \"single\",\n        ]:","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/integrations/generic_api/generic_api_callback.py#L139-L175","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\nGenericAPILogger()  # no env var -> ValueError\n\n# after\nGenericAPILogger(endpoint='https://logs.example.com/ingest')","handlingStrategy":"validation","validationCode":"import os\n\nendpoint = endpoint or os.getenv('GENERIC_LOGGER_ENDPOINT')\nif endpoint is None:\n    raise SystemExit('GENERIC_LOGGER_ENDPOINT env var or endpoint= arg is required for GenericAPILogger')","typeGuard":"def generic_logger_endpoint_set() -> bool:\n    return os.getenv('GENERIC_LOGGER_ENDPOINT') is not None","tryCatchPattern":"try:\n    GenericAPILogger()\nexcept ValueError as e:\n    if 'GENERIC_LOGGER_ENDPOINT' in str(e):\n        raise ConfigError('Set GENERIC_LOGGER_ENDPOINT or pass endpoint=') from e\n    raise","preventionTips":["Prefer passing endpoint explicitly in code over relying on ambient env vars.","Add GENERIC_LOGGER_ENDPOINT to your environment template with a placeholder comment."],"tags":["generic-api","logging-callback","missing-env-var","configuration"],"backgroundTag":"missing-env-var","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}