{"record":{"id":"911f7cb1b6dcf94d","repo":"BerriAI/litellm","slug":"ssml-input-is-required-when-use-ssml-is-true","errorCode":null,"errorMessage":"SSML input is required when use_ssml is True.","messagePattern":"SSML input is required when use_ssml is True\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/vertex_ai/text_to_speech/text_to_speech_handler.py","lineNumber":222,"sourceCode":"        http_binary_response: Final = HttpxBinaryResponseContent(response)\n        return http_binary_response\n\n\ndef validate_vertex_input(input_data: VertexInput, kwargs: dict, optional_params: dict) -> None:\n    # Remove None values\n    if input_data.get(\"text\") is None:\n        input_data.pop(\"text\", None)\n    if input_data.get(\"ssml\") is None:\n        input_data.pop(\"ssml\", None)\n\n    # Check if use_ssml is set\n    use_ssml: Final = kwargs.get(\"use_ssml\", 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","sourceCodeStart":204,"sourceCodeEnd":235,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/vertex_ai/text_to_speech/text_to_speech_handler.py#L204-L235","documentation":"Raised by validate_vertex_input when the Vertex text-to-speech request has use_ssml=True but the input contains neither 'text' nor 'ssml'. The validator first strips None values and, when use_ssml is set, converts any 'text' entry into 'ssml'; this error fires only when both keys are absent after that cleanup, meaning the caller enabled SSML mode without supplying any content at all.","triggerScenarios":"Thrown at litellm/llms/vertex_ai/text_to_speech/text_to_speech_handler.py:222 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["When use_ssml=True, pass the SSML markup via the ssml/input parameter instead of plain text.","Set use_ssml=False (or omit it) if you intend to synthesize plain 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-14T05:17:10.506Z"}