{"record":{"id":"ffd4eaef1984809d","repo":"microsoft/VibeVoice","slug":"could-not-process-input-text-text","errorCode":null,"errorMessage":"Could not process input text: {text}","messagePattern":"Could not process input text: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"vibevoice/processor/vibevoice_processor.py","lineNumber":265,"sourceCode":"        self,\n        text: Union[str, TextInput],\n        voice_samples: Optional[List[Union[str, np.ndarray]]] = None,\n    ) -> Dict[str, Any]:\n        \"\"\"Process a single podcast script.\"\"\"\n        # Determine if text is a file path or direct script\n        script = None\n        if isinstance(text, str):\n            # Check if it's a file path\n            if text.endswith('.json') and os.path.exists(text):\n                script = self._convert_json_to_script(text)\n            elif text.endswith('.txt') and os.path.exists(text):\n                script = self._convert_text_to_script(text)\n            else:\n                # Assume it's the script content directly\n                script = text\n        \n        if script is None:\n            raise ValueError(f\"Could not process input text: {text}\")\n        \n        # Parse the script\n        parsed_lines = self._parse_script(script)\n        all_speakers = list(set(speaker_id for speaker_id, _ in parsed_lines))\n        \n        # Create system prompt\n        # system_tokens = self.tokenizer.encode(self.system_prompt, add_special_tokens=False)\n        system_tokens = self.tokenizer.encode(self.system_prompt)\n        \n        # Process voice samples if provided\n        if voice_samples:\n            voice_tokens, voice_speech_inputs, voice_speech_masks = self._create_voice_prompt(voice_samples[:len(all_speakers)])\n        else:\n            voice_tokens, voice_speech_inputs, voice_speech_masks = [], [], []\n        \n        # Build full token sequence\n        full_tokens = system_tokens + voice_tokens\n        speech_input_mask = [False] * len(system_tokens) + voice_speech_masks","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/microsoft/VibeVoice/blob/94da20d98b2fa7688e9cbfaf7692ddb4954f7600/vibevoice/processor/vibevoice_processor.py#L247-L283","documentation":"VibeVoiceProcessor's input-text normalization turns the `text` argument into an internal 'script'. A plain string is accepted directly (as script content), and .json/.txt paths are loaded from disk. `script` remains None only when `text` is not a string at all — e.g. None, a dict, or a list — which is exactly what this error signals.","triggerScenarios":"Calling processor(text=None), passing a list of dialogue dicts (the JSON-format entries) directly instead of a file path, or passing a Path object if the isinstance(str) check is bypassed by a non-str type.","commonSituations":"Users who know the processor accepts JSON-format scripts and try to pass parsed JSON (a Python list) instead of the path to the .json file; upstream code that builds text conditionally and passes None when no prompt was configured.","solutions":["Pass a str: either the raw script ('Speaker 1: hello') or a path to a .json/.txt file.","If you have parsed speaker entries in memory, serialize them to a temp .json file and pass that path.","Default empty prompts to '' rather than None if you need a no-text call to proceed."],"exampleFix":"# before\nentries = [{'speaker': '1', 'text': 'Hi'}]\nprocessor(text=entries)  # not a str -> ValueError\n\n# after\nimport json, tempfile\nwith tempfile.NamedTemporaryFile('w', suffix='.json', delete=False) as f:\n    json.dump(entries, f)\n    path = f.name\nprocessor(text=path)","handlingStrategy":"type-guard","validationCode":"if not isinstance(text, str):\n    if isinstance(text, list):  # parsed speaker entries\n        import tempfile, json\n        with tempfile.NamedTemporaryFile('w', suffix='.json', delete=False) as f:\n            json.dump(text, f); path = f.name\n        text = path\n    else:\n        raise TypeError(f'text must be str, got {type(text).__name__}')","typeGuard":"def is_valid_script_input(text) -> bool:\n    return isinstance(text, str) and len(text) > 0 and (\n        not text.endswith(('.json', '.txt')) or os.path.exists(text))","tryCatchPattern":"try:\n    enc = processor(text=text)\nexcept ValueError as e:\n    if 'Could not process input text' in str(e):\n        raise TypeError('text must be a script string or .json/.txt path') from e\n    raise","preventionTips":["Always pass text as a str (script content or file path); never parsed objects or None.","Default absent prompts to '' rather than None in pipeline code.","Serialize in-memory speaker dicts to a temp .json file before calling."],"tags":["input-validation","script","text-processing","tts"],"backgroundTag":null,"analyzedSha":"94da20d98b2fa7688e9cbfaf7692ddb4954f7600","analyzedAt":"2026-08-15T04:12:07.418Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}