{"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/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/integrations/cloudzero/cloudzero.py#L102-L138","documentation":"ValueError from CloudZeroLogger's usage-export routine when either CLOUDZERO_API_KEY or CLOUDZERO_CONNECTION_ID is empty/None at export time. The check runs inside the export job after imports, so the logger constructs fine but the export fails — typically in a background task or scheduled job. Both values come from the logger's initialization settings/env.","triggerScenarios":"Configuring the cloudzero callback without providing both required settings, providing the API key via a differently-named env var, or a config file where cloudzero settings keys are misspelled so they default to None.","commonSituations":"Onboarding CloudZero cost analytics: connection created in the CloudZero dashboard but its ID never copied into proxy config; secrets mounted but env var names differ from expected; staging config promoted to prod without the cloudzero credentials block.","solutions":["Set both CLOUDZERO_API_KEY and CLOUDZERO_CONNECTION_ID environment variables for the proxy process","Get the connection ID from the CloudZero dashboard (Streamer connection settings) — it is a UUID, not the connection name","Verify both are visible to the process: printenv | grep CLOUDZERO","If CloudZero export is not wanted, remove/disable the scheduled export so the config check never fires"],"exampleFix":"# before\n# proxy config enables cloudzero logger without credentials\nenvironment_variables: {}\n\n# after\nenvironment_variables:\n  CLOUDZERO_API_KEY: os.environ/CLOUDZERO_API_KEY\n  CLOUDZERO_CONNECTION_ID: os.environ/CLOUDZERO_CONNECTION_ID","handlingStrategy":"validation","validationCode":"import os\n\ndef cloudzero_config_ready() -> tuple[bool, list[str]]:\n    missing = [k for k in (\"CLOUDZERO_API_KEY\", \"CLOUDZERO_CONNECTION_ID\") if not os.getenv(k)]\n    return (not missing, missing)\n\nok, missing = cloudzero_config_ready()\nif not ok:\n    raise RuntimeError(f\"CloudZero export disabled: missing {missing}\")","typeGuard":null,"tryCatchPattern":"try:\n    await cloudzero_logger.export_usage_data(...)\nexcept ValueError as e:\n    if \"configuration missing\" in str(e):\n        logger.error(\"CloudZero credentials absent; skipping export cycle\")\n    else:\n        raise","preventionTips":["Check both env vars in a startup config validation step","Copy the connection ID (UUID) from CloudZero exactly — not the name","Add config schema validation so misspelled keys fail loudly"],"tags":["cloudzero","environment-variables","configuration","cost-analytics"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}