{"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/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/integrations/generic_api/generic_api_callback.py#L139-L175","documentation":"GenericAPILogger raises ValueError when no endpoint can be resolved: the constructor takes an optional endpoint param, falls back to the GENERIC_LOGGER_ENDPOINT env var, and if both are absent it cannot send logs anywhere. Note that when a callback_name matches an entry in generic_api_compatible_callbacks.json, endpoint may come from that file; the raise covers the case where none of these sources produced a URL.","triggerScenarios":"Adding 'generic_api' to callbacks with neither endpoint passed programmatically nor GENERIC_LOGGER_ENDPOINT exported, and no matching callback_name entry providing an endpoint.","commonSituations":"Env var missing in the deployed environment; typo in the var name; callback_name that does not exist in the JSON config file (only a warning is logged, then the missing endpoint surfaces here).","solutions":["Set GENERIC_LOGGER_ENDPOINT=https://logger.example.com/ingest in the proxy environment.","Or pass endpoint= explicitly when constructing GenericAPILogger.","If using callback_name, verify it exists in generic_api_compatible_callbacks.json — a miss only warns and leaves endpoint unset."],"exampleFix":"# before\nGenericAPILogger()  # no endpoint, no env var\n\n# after\nGenericAPILogger(endpoint=\"https://logger.example.com/ingest\")","handlingStrategy":"validation","validationCode":"import os\n\nif \"generic_api\" in callbacks and not (os.getenv(\"GENERIC_LOGGER_ENDPOINT\") or callback_name_in_json):\n    raise ValueError(\"GENERIC_LOGGER_ENDPOINT is required when the generic_api callback is enabled\")","typeGuard":"def generic_logger_ready(explicit_endpoint: str | None) -> bool:\n    import os\n    return bool(explicit_endpoint or os.getenv(\"GENERIC_LOGGER_ENDPOINT\"))","tryCatchPattern":null,"preventionTips":["Set GENERIC_LOGGER_ENDPOINT in the same environment that runs the proxy.","When using callback_name, verify the name exists in generic_api_compatible_callbacks.json — a miss only logs a warning and later fails here.","Construct GenericAPILogger(endpoint=...) explicitly in code-based setups to avoid env dependency."],"tags":["generic-api","env-vars","config","logging-callback"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}