{"record":{"id":"9a8c66704dfcba21","repo":"BerriAI/litellm","slug":"mavvrik-api-key-must-be-provided-for-mavvrik-focus","errorCode":null,"errorMessage":"MAVVRIK_API_KEY must be provided for Mavvrik FOCUS destination (set MAVVRIK_API_KEY env var or pass in destination_config)","messagePattern":"MAVVRIK_API_KEY must be provided for Mavvrik FOCUS destination \\(set MAVVRIK_API_KEY env var or pass in destination_config\\)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/focus/destinations/mavvrik_destination.py","lineNumber":67,"sourceCode":"        )\n\n\nclass FocusMavvrikDestination(FocusDestination):\n    \"\"\"Upload FOCUS CSV exports to Mavvrik via GCS signed URL.\"\"\"\n\n    def __init__(\n        self,\n        *,\n        prefix: str,\n        config: dict[str, Any] | None = None,\n    ) -> None:\n        config = config or {}\n        api_key: Final = config.get(\"api_key\")\n        api_endpoint: Final = config.get(\"api_endpoint\")\n        connection_id: Final = config.get(\"connection_id\")\n\n        if not api_key:\n            raise ValueError(\n                \"MAVVRIK_API_KEY must be provided for Mavvrik FOCUS destination \"\n                \"(set MAVVRIK_API_KEY env var or pass in destination_config)\"\n            )\n        if not api_endpoint:\n            raise ValueError(\n                \"MAVVRIK_API_ENDPOINT must be provided for Mavvrik FOCUS destination \"\n                \"(set MAVVRIK_API_ENDPOINT env var or pass in destination_config)\"\n            )\n        if not connection_id:\n            raise ValueError(\n                \"MAVVRIK_CONNECTION_ID must be provided for Mavvrik FOCUS destination \"\n                \"(set MAVVRIK_CONNECTION_ID env var or pass in destination_config)\"\n            )\n\n        _validate_api_endpoint(api_endpoint)\n\n        self.api_key = api_key\n        self.api_endpoint = api_endpoint.rstrip(\"/\")","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/integrations/focus/destinations/mavvrik_destination.py#L49-L85","documentation":"FocusMavvrikDestination.__init__ requires api_key from the config dict (the factory normally populates it from MAVVRIK_API_KEY). Unlike the factory path, this constructor does not read env vars itself — if you bypass the factory and pass no api_key, it raises immediately with guidance to set the env var or destination_config entry.","triggerScenarios":"Constructing FocusMavvrikDestination(prefix=..., config={...}) directly with no api_key key (config=None or {}), or via the factory with MAVVRIK_API_KEY unset and no override.","commonSituations":"Secret not mounted in k8s; env var name typo (MAVRIK_API_KEY); direct class instantiation in custom wiring; empty-string value from secrets templating.","solutions":["Set MAVVRIK_API_KEY in the environment (and let the factory pass it through), or put api_key in the destination config dict.","Verify the value is non-empty before creating the destination.","If constructing the class directly, mirror the factory: config['api_key'] = os.environ['MAVVRIK_API_KEY']."],"exampleFix":"# before\ndest = FocusMavvrikDestination(prefix=\"focus\", config={\"api_endpoint\": ep, \"connection_id\": cid})\n\n# after\ndest = FocusMavvrikDestination(\n    prefix=\"focus\",\n    config={\n        \"api_key\": os.environ[\"MAVVRIK_API_KEY\"],\n        \"api_endpoint\": ep,\n        \"connection_id\": cid,\n    },\n)","handlingStrategy":"validation","validationCode":"import os\n\nif not (os.getenv(\"MAVVRIK_API_KEY\") or config.get(\"api_key\")):\n    raise SystemExit(\"MAVVRIK_API_KEY missing: set it or pass api_key in destination config\")","typeGuard":null,"tryCatchPattern":"try:\n    dest = FocusMavvrikDestination(prefix=p, config=cfg)\nexcept ValueError as e:\n    if \"MAVVRIK_API_KEY\" in str(e):\n        log_config_error(\"mavvrik\", missing=[\"api_key\"])\n    raise","preventionTips":["Set all three MAVVRIK_* vars together from one secret; partial setups fail one field at a time.","Add a startup assertion for every required Mavvrik var when the mavvrik export is enabled."],"tags":["focus","mavvrik","configuration","env-var","validation"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}