microsoft/VibeVoice · error · ValueError
No valid content found in text file
Error message
No valid content found in text file
What it means
When `text` points at a .txt file, each line is either matched as 'Speaker N: ...' or treated as plain dialogue text assigned to a running speaker. script_lines only stays empty when every line was blank/whitespace, so this error effectively means the text file contains no usable content.
Source
Thrown at vibevoice/processor/vibevoice_processor.py:592
line = line.strip()
if not line:
continue
# Try to parse as "Speaker X: text" format
# Use regex to be more robust
speaker_match = re.match(r'^Speaker\s+(\d+)\s*:\s*(.*)$', line, re.IGNORECASE)
if speaker_match:
speaker_id = int(speaker_match.group(1))
text = speaker_match.group(2).strip()
if text:
script_lines.append(f"Speaker {speaker_id}: {text}")
else:
# Treat as plain text - assign to current speaker
script_lines.append(f"Speaker {current_speaker}: {line}")
if not script_lines:
raise ValueError("No valid content found in text file")
return "\n".join(script_lines)
def _parse_script(self, script: str) -> List[Tuple[int, str]]:
"""Parse script into list of (speaker_id, text) tuples."""
lines = script.strip().split("\n")
parsed_lines = []
speaker_ids = []
# First pass: parse all lines and collect speaker IDs
for line in lines:
if not line.strip():
continue
# Use regex to handle edge cases like multiple colons
match = re.match(r'^Speaker\s+(\d+)\s*:\s*(.*)$', line.strip(), re.IGNORECASE)
if match:View on GitHub (pinned to 94da20d98b)
Solutions
- Verify the file has non-blank lines: check file size and open it to confirm content.
- If the file legitimately has no dialogue, guard upstream and skip the call instead of feeding an empty transcript.
- Re-export or re-download the transcript if it was truncated.
Example fix
# before processor(text='dialog.txt') # dialog.txt is empty # after # dialog.txt: # Speaker 1: Welcome to the show. # Speaker 2: Thanks for having me. processor(text='dialog.txt')
Defensive patterns
Strategy: validation
Validate before calling
content = open(text_path).read()
if not content.strip():
raise ValueError(f'transcript file is empty: {text_path}')
enc = processor(text=text_path) Type guard
def is_nonempty_text_file(path: str) -> bool:
return os.path.exists(path) and os.path.getsize(path) > 0 Try / catch
try:
enc = processor(text=text_path)
except ValueError as e:
if 'No valid content' in str(e):
raise ValueError(f'transcript {text_path} is empty or whitespace-only') from e
raise Prevention
- Check file size/content before passing paths into the processor.
- Validate downloaded transcripts immediately after download, not at inference time.
- Skip empty shards explicitly in batch loops.
When it happens
Trigger: Passing a .txt path that exists but is empty or contains only blank lines/whitespace; pointing at the wrong file (e.g. a placeholder or a truncated download).
Common situations: Zero-byte transcript files from a failed download or interrupted export; passing a directory-adjacent file of the same name; files with only a BOM or newline characters.
Related errors
- No valid entries found in JSON file
- JSON file must contain a list of speaker entries
- Audio input is required for ASR processing
- Could not process input text: {text}
- No valid speaker lines found in script
AI-assisted analysis of microsoft/VibeVoice@94da20d98b (2026-08-15).
Data as JSON: /api/errors/f6bb3fa0127d9ddb.
Report an issue: GitHub.