microsoft/VibeVoice · error · ValueError

Could not process input text: {text}

Error message

Could not process input text: {text}

What it means

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.

Source

Thrown at vibevoice/processor/vibevoice_processor.py:265

        self,
        text: Union[str, TextInput],
        voice_samples: Optional[List[Union[str, np.ndarray]]] = None,
    ) -> Dict[str, Any]:
        """Process a single podcast script."""
        # Determine if text is a file path or direct script
        script = None
        if isinstance(text, str):
            # Check if it's a file path
            if text.endswith('.json') and os.path.exists(text):
                script = self._convert_json_to_script(text)
            elif text.endswith('.txt') and os.path.exists(text):
                script = self._convert_text_to_script(text)
            else:
                # Assume it's the script content directly
                script = text
        
        if script is None:
            raise ValueError(f"Could not process input text: {text}")
        
        # Parse the script
        parsed_lines = self._parse_script(script)
        all_speakers = list(set(speaker_id for speaker_id, _ in parsed_lines))
        
        # Create system prompt
        # system_tokens = self.tokenizer.encode(self.system_prompt, add_special_tokens=False)
        system_tokens = self.tokenizer.encode(self.system_prompt)
        
        # Process voice samples if provided
        if voice_samples:
            voice_tokens, voice_speech_inputs, voice_speech_masks = self._create_voice_prompt(voice_samples[:len(all_speakers)])
        else:
            voice_tokens, voice_speech_inputs, voice_speech_masks = [], [], []
        
        # Build full token sequence
        full_tokens = system_tokens + voice_tokens
        speech_input_mask = [False] * len(system_tokens) + voice_speech_masks

View on GitHub (pinned to 94da20d98b)

Solutions

  1. Pass a str: either the raw script ('Speaker 1: hello') or a path to a .json/.txt file.
  2. If you have parsed speaker entries in memory, serialize them to a temp .json file and pass that path.
  3. Default empty prompts to '' rather than None if you need a no-text call to proceed.

Example fix

# before
entries = [{'speaker': '1', 'text': 'Hi'}]
processor(text=entries)  # not a str -> ValueError

# after
import json, tempfile
with tempfile.NamedTemporaryFile('w', suffix='.json', delete=False) as f:
    json.dump(entries, f)
    path = f.name
processor(text=path)
Defensive patterns

Strategy: type-guard

Validate before calling

if not isinstance(text, str):
    if isinstance(text, list):  # parsed speaker entries
        import tempfile, json
        with tempfile.NamedTemporaryFile('w', suffix='.json', delete=False) as f:
            json.dump(text, f); path = f.name
        text = path
    else:
        raise TypeError(f'text must be str, got {type(text).__name__}')

Type guard

def is_valid_script_input(text) -> bool:
    return isinstance(text, str) and len(text) > 0 and (
        not text.endswith(('.json', '.txt')) or os.path.exists(text))

Try / catch

try:
    enc = processor(text=text)
except ValueError as e:
    if 'Could not process input text' in str(e):
        raise TypeError('text must be a script string or .json/.txt path') from e
    raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of microsoft/VibeVoice@94da20d98b (2026-08-15). Data as JSON: /api/errors/ffd4eaef1984809d. Report an issue: GitHub.