{"record":{"id":"316c0f94eb217507","repo":"BerriAI/litellm","slug":"only-one-of-text-or-ssml-should-be-provided-n-316c0f","errorCode":null,"errorMessage":"Only one of 'text' or 'ssml' should be provided, not both.","messagePattern":"Only one of 'text' or 'ssml' should be provided, not both\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/vertex_ai/text_to_speech/transformation.py","lineNumber":334,"sourceCode":"        use_ssml: Final = optional_params.get(\"use_ssml\", False)\n\n        if use_ssml:\n            if \"text\" in input_data:\n                input_data[\"ssml\"] = input_data.pop(\"text\")\n            elif \"ssml\" not in input_data:\n                raise ValueError(\"SSML input is required when use_ssml is True.\")\n        else:\n            # LiteLLM will auto-detect if text is in ssml format\n            # check if \"text\" is an ssml - in this case we should pass it as ssml instead of text\n            if input_data:\n                _text: Final = input_data.get(\"text\", None) or \"\"\n                if \"<speak>\" in _text:\n                    input_data[\"ssml\"] = input_data.pop(\"text\")\n\n        if not input_data:\n            raise ValueError(\"Either 'text' or 'ssml' must be provided.\")\n        if \"text\" in input_data and \"ssml\" in input_data:\n            raise ValueError(\"Only one of 'text' or 'ssml' should be provided, not both.\")\n\n        return input_data\n\n    def transform_text_to_speech_request(\n        self,\n        model: str,\n        input: str,\n        voice: str | None,\n        optional_params: dict,\n        litellm_params: dict,\n        headers: dict,\n    ) -> TextToSpeechRequestData:\n        \"\"\"\n        Transform OpenAI TTS request to Vertex AI TTS format\n\n        This method handles:\n        1. Authentication with Vertex AI\n        2. Building the request body","sourceCodeStart":316,"sourceCodeEnd":352,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/vertex_ai/text_to_speech/transformation.py#L316-L352","documentation":"Duplicate of the TTS mutual-exclusion guard in transformation.py: both 'text' and 'ssml' were provided for a non-SSML-flagged call. The handler auto-detects '<speak>' markup but will not guess between two explicit inputs, so it refuses the request.","triggerScenarios":"Thrown at litellm/llms/vertex_ai/text_to_speech/transformation.py:334 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Send only one of 'text' or 'ssml' in the input payload; drop the other field.","Choose 'ssml' (with use_ssml=True) for markup content, otherwise 'text'."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}