{"record":{"id":"2a5905f1788e0a73","repo":"BerriAI/litellm","slug":"input-is-required","errorCode":null,"errorMessage":"input is required","messagePattern":"input is required","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/endpoints/speech/speech_to_completion_bridge/handler.py","lineNumber":45,"sourceCode":"        from .transformation import SpeechToCompletionBridgeTransformationHandler\n\n        super().__init__()\n        self.transformation_handler = SpeechToCompletionBridgeTransformationHandler()\n\n    def validate_input_kwargs(self, kwargs: dict) -> SpeechToCompletionBridgeHandlerInputKwargs:\n        from litellm import LiteLLMLoggingObj\n\n        model: Final = kwargs.get(\"model\")\n        if model is None or not isinstance(model, str):\n            raise ValueError(\"model is required\")\n\n        custom_llm_provider: Final = kwargs.get(\"custom_llm_provider\")\n        if custom_llm_provider is None or not isinstance(custom_llm_provider, str):\n            raise ValueError(\"custom_llm_provider is required\")\n\n        input: Final = kwargs.get(\"input\")\n        if input is None or not isinstance(input, str):\n            raise ValueError(\"input is required\")\n\n        optional_params: Final = kwargs.get(\"optional_params\")\n        if optional_params is None or not isinstance(optional_params, dict):\n            raise ValueError(\"optional_params is required\")\n\n        litellm_params: Final = kwargs.get(\"litellm_params\")\n        if litellm_params is None or not isinstance(litellm_params, dict):\n            raise ValueError(\"litellm_params is required\")\n\n        headers = kwargs.get(\"headers\")\n        if headers is None or not isinstance(headers, dict):\n            raise ValueError(\"headers is required\")\n\n        headers = kwargs.get(\"headers\")\n        if headers is None or not isinstance(headers, dict):\n            raise ValueError(\"headers is required\")\n\n        logging_obj: Final = kwargs.get(\"logging_obj\")","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/endpoints/speech/speech_to_completion_bridge/handler.py#L27-L63","documentation":"validate_input_kwargs in the speech-to-completion bridge raises ValueError(\"input is required\") when kwargs[\"input\"] is missing, None, or not a str. \"input\" is the text to be spoken; it becomes the user message content of the bridged chat-completion request (transformation.py:39). Because it must be a str, passing bytes or a list of content parts fails the isinstance check.","triggerScenarios":"Calling the handler (or a custom speech pipeline built on it) with input omitted, None, or as bytes/bytearray (e.g. passing pre-encoded audio or file content) instead of the text string to synthesize.","commonSituations":"Wrappers that accept file paths or SSML objects and forward them unmodified; empty-payload requests from clients hitting a custom endpoint; tests omitting the field.","solutions":["Pass the text to synthesize as a plain str: handler.speech(..., input=\"text to speak\", ...).","Decode before forwarding: input=my_bytes.decode(\"utf-8\") if your pipeline carries bytes.","Validate input early in your own wrapper (non-empty str) to fail with a clearer message."],"exampleFix":"# before\nhandler.speech(model=\"gpt-4o-audio-preview\", input=b\"hello world\", ...)  # ValueError: input is required\n\n# after\nhandler.speech(model=\"gpt-4o-audio-preview\", input=\"hello world\", ...)","handlingStrategy":"validation","validationCode":"def check_speech_input(kwargs: dict) -> None:\n    value = kwargs.get(\"input\")\n    if not isinstance(value, str) or not value:\n        raise ValueError(\"speech bridge requires non-empty str 'input' (decode bytes first)\")","typeGuard":"def is_valid_input_kwarg(value: object) -> bool:\n    return isinstance(value, str) and len(value) > 0","tryCatchPattern":null,"preventionTips":["Decode bytes/bytearray to utf-8 str before forwarding input.","Reject empty prompts in your wrapper with a clearer message than the bridge's.","Keep SSML/objects out of input — the bridge treats it as plain message content."],"tags":["speech","tts","validation","kwargs","internal-api"],"backgroundTag":"missing-required-argument","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}