{"record":{"id":"f7ca65b30a5796d4","repo":"BerriAI/litellm","slug":"argilla-transformation-object-must-be-a-dictiona","errorCode":null,"errorMessage":"'argilla_transformation_object' must be a dictionary, to log your payload to Argilla.","messagePattern":"'argilla_transformation_object' must be a dictionary, to log your payload to Argilla\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/integrations/argilla.py","lineNumber":74,"sourceCode":"            argilla_base_url=argilla_base_url,\n        )\n        self.sampling_rate: float = (\n            float(os.getenv(\"ARGILLA_SAMPLING_RATE\"))\n            if os.getenv(\"ARGILLA_SAMPLING_RATE\") is not None and os.getenv(\"ARGILLA_SAMPLING_RATE\").strip().isdigit()\n            else 1.0\n        )\n\n        self.async_httpx_client = get_async_httpx_client(llm_provider=httpxSpecialProvider.LoggingCallback)\n        _batch_size: Final = os.getenv(\"ARGILLA_BATCH_SIZE\", None) or litellm.argilla_batch_size\n        if _batch_size:\n            self.batch_size = int(_batch_size)\n        asyncio.create_task(self.periodic_flush())\n        self.flush_lock = asyncio.Lock()\n        super().__init__(**kwargs, flush_lock=self.flush_lock)\n\n    def validate_argilla_transformation_object(self, argilla_transformation_object: dict[str, Any]):\n        if not isinstance(argilla_transformation_object, dict):\n            raise Exception(\"'argilla_transformation_object' must be a dictionary, to log your payload to Argilla.\")\n\n        for v in argilla_transformation_object.values():\n            if v not in SUPPORTED_PAYLOAD_FIELDS:\n                raise Exception(\n                    f\"All values in argilla_transformation_object must be a key in SUPPORTED_PAYLOAD_FIELDS, {v} is not a valid key.\"\n                )\n\n    def get_credentials_from_env(\n        self,\n        argilla_api_key: str | None,\n        argilla_dataset_name: str | None,\n        argilla_base_url: str | None,\n    ) -> ArgillaCredentialsObject:\n        _credentials_api_key: Final = argilla_api_key or os.getenv(\"ARGILLA_API_KEY\")\n        if _credentials_api_key is None:\n            raise Exception(\"Invalid Argilla API Key given. _credentials_api_key=None.\")\n\n        _credentials_base_url: Final = argilla_base_url or os.getenv(\"ARGILLA_BASE_URL\") or \"http://localhost:6900/\"","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/integrations/argilla.py#L56-L92","documentation":"`litellm.argilla_transformation_object` must be a dict that maps Argilla dataset field names to LiteLLM payload keys. `validate_argilla_transformation_object` runs during ArgillaLogger construction and rejects anything that is not a dict (e.g. a list, string, or JSON-decoded array) because it iterates `.values()` to check each mapping.","triggerScenarios":"Assigning `litellm.argilla_transformation_object = [\"messages\", \"response\"]` (a list) or `= \"messages\"` (a string) or loading it from YAML/JSON that parses to a list, then triggering ArgillaLogger initialization with `litellm.callbacks = [\"argilla\"]`.","commonSituations":"Hand-writing the config as a list of fields instead of a mapping; a YAML config where indentation turns the intended dict into a list of strings; programmatic config built by appending field names.","solutions":["Change the value to a dict mapping Argilla field -> payload key, e.g. `litellm.argilla_transformation_object = {\"prompt\": \"messages\", \"response\": \"response\"}`","If loading from config files, print `type(litellm.argilla_transformation_object)` right before the callback fires to confirm it is a dict","Ensure every VALUE in the dict is one of SUPPORTED_PAYLOAD_FIELDS (currently \"messages\" or \"response\") so the next validation passes"],"exampleFix":"# before\nlitellm.argilla_transformation_object = [\"messages\", \"response\"]  # list -> raises\n\n# after\nlitellm.argilla_transformation_object = {\n    \"prompt\": \"messages\",\n    \"response\": \"response\",\n}","handlingStrategy":"type-guard","validationCode":"from litellm.types.integrations.argilla import SUPPORTED_PAYLOAD_FIELDS\n\ndef build_transformation_object(mapping: dict) -> dict:\n    if not isinstance(mapping, dict):\n        raise TypeError(f\"expected dict, got {type(mapping).__name__}\")\n    bad = [v for v in mapping.values() if v not in SUPPORTED_PAYLOAD_FIELDS]\n    if bad:\n        raise ValueError(f\"unsupported payload keys: {bad}; allowed: {SUPPORTED_PAYLOAD_FIELDS}\")\n    return mapping","typeGuard":"def is_argilla_mapping(obj: object) -> bool:\n    return isinstance(obj, dict) and all(isinstance(k, str) and isinstance(v, str) for k, v in obj.items())","tryCatchPattern":"try:\n    ArgillaLogger()  # or trigger via callbacks\nexcept Exception as e:\n    msg = str(e)\n    if \"must be a dictionary\" in msg:\n        # fix shape then retry init once\n        litellm.argilla_transformation_object = dict.fromkeys(\n            litellm.argilla_transformation_object or [], \"response\"\n        )\n    else:\n        raise","preventionTips":["Write the transformation object as literal dict in config, never build it by appending to a list","Unit-test your config loader asserts type(x) is dict before assignment"],"tags":["argilla","type-validation","configuration","logging"],"backgroundTag":"schema-validation-failed","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}