{"record":{"id":"19a0cd1129ef7b6a","repo":"BerriAI/litellm","slug":"cloudzero-configuration-missing-please-set-cloudz","errorCode":null,"errorMessage":"CloudZero configuration missing. Please set CLOUDZERO_API_KEY and CLOUDZERO_CONNECTION_ID environment variables.","messagePattern":"CloudZero configuration missing\\. Please set CLOUDZERO_API_KEY and CLOUDZERO_CONNECTION_ID environment variables\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/cloudzero/cloudzero.py","lineNumber":120,"sourceCode":"\n        - Reads data from the DB\n        - Transforms the data to the CloudZero format\n        - Sends the data to CloudZero\n\n        Args:\n            limit: Optional limit on number of records to export\n            operation: CloudZero operation type (\"replace_hourly\" or \"sum\")\n        \"\"\"\n        from litellm.integrations.cloudzero.cz_stream_api import CloudZeroStreamer\n        from litellm.integrations.cloudzero.database import LiteLLMDatabase\n        from litellm.integrations.cloudzero.transform import CBFTransformer\n\n        try:\n            verbose_logger.debug(\"CloudZero Logger: Starting usage data export\")\n\n            # Validate required configuration\n            if not self.api_key or not self.connection_id:\n                raise ValueError(\n                    \"CloudZero configuration missing. Please set CLOUDZERO_API_KEY and CLOUDZERO_CONNECTION_ID environment variables.\"\n                )\n\n            # Initialize database connection and load data\n            database: Final = LiteLLMDatabase()\n            verbose_logger.debug(\"CloudZero Logger: Loading usage data from database\")\n            data = await database.get_usage_data(limit=limit, start_time_utc=start_time_utc, end_time_utc=end_time_utc)\n\n            if data.is_empty():\n                verbose_logger.debug(\"CloudZero Logger: No usage data found to export\")\n                return\n\n            verbose_logger.debug(\"CloudZero Logger: Processing %s records\", len(data))\n\n            # Transform data to CloudZero CBF format\n            transformer: Final = CBFTransformer()\n            cbf_data: Final = transformer.transform(data)\n","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/integrations/cloudzero/cloudzero.py#L102-L138","documentation":"ValueError raised by the CloudZero logger's export_usage_data when self.api_key or self.connection_id is falsy — i.e. neither the callback config nor the environment provided CLOUDZERO_API_KEY and CLOUDZERO_CONNECTION_ID. It fires at the start of an export run, before any database query or API call, and names both required variables.","triggerScenarios":"Triggering the CloudZero usage export (scheduled cron inside the proxy or the export endpoint/job) while one or both of CLOUDZERO_API_KEY / CLOUDZERO_CONNECTION_ID are unset or empty in the proxy's environment. Values set only in a local .env, a typo'd name, or a restarted container that lost env config all trigger it.","commonSituations":"Docker/Kubernetes deployments missing the env entries; secrets renamed or removed; CI running export jobs without injecting credentials; trailing quotes/spaces making a variable technically set but the connection_id empty.","solutions":["Set both variables in the proxy runtime: export CLOUDZERO_API_KEY=... and export CLOUDZERO_CONNECTION_ID=...","If using the callback config, pass the values there instead (litellm_params on the cloudzero callback)","Restart the LiteLLM proxy after setting them — config is read at logger init","Verify in the exact runtime: printenv CLOUDZERO_API_KEY CLOUDZERO_CONNECTION_ID (both non-empty)"],"exampleFix":"# before\n$ docker run litellm/litellm ...   # env not passed\n\n# after\n$ docker run -e CLOUDZERO_API_KEY -e CLOUDZERO_CONNECTION_ID litellm/litellm ...","handlingStrategy":"validation","validationCode":"import os\n\nmissing = [v for v in (\"CLOUDZERO_API_KEY\", \"CLOUDZERO_CONNECTION_ID\") if not os.getenv(v)]\nif missing:\n    raise RuntimeError(f\"cannot export to CloudZero; missing env vars: {missing}\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Declare both CLOUDZERO_API_KEY and CLOUDZERO_CONNECTION_ID in the deployment spec (Deployment env / docker -e)","Add a preflight check in the export job that fails loudly before querying usage data","Verify with printenv in the exact runtime after deploys","Watch for empty-string values — falsy counts as missing here"],"tags":["cloudzero","missing-env-var","usage-export","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"}