{"record":{"id":"9666bc7d501ae7dd","repo":"microsoft/VibeVoice","slug":"empty-audio-list-provided","errorCode":null,"errorMessage":"Empty audio list provided","messagePattern":"Empty audio list provided","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"vibevoice/processor/vibevoice_tokenizer_processor.py","lineNumber":159,"sourceCode":"        \"\"\"\n        if audio is None:\n            raise ValueError(\"Audio input is required\")\n        \n        # Validate sampling rate\n        if sampling_rate is not None and sampling_rate != self.sampling_rate:\n            logger.warning(\n                f\"Input sampling rate ({sampling_rate}) differs from expected \"\n                f\"sampling rate ({self.sampling_rate}). Please resample your audio.\"\n            )\n        \n        # Handle different input types\n        if isinstance(audio, str):\n            # Single audio file path\n            audio = self._load_audio_from_path(audio)\n            is_batched = False\n        elif isinstance(audio, list):\n            if len(audio) == 0:\n                raise ValueError(\"Empty audio list provided\")\n            \n            # Check if it's a list of file paths\n            if all(isinstance(item, str) for item in audio):\n                # Batch of audio file paths\n                audio = [self._load_audio_from_path(path) for path in audio]\n                is_batched = True\n            else:\n                # Check if it's batched audio arrays\n                is_batched = isinstance(audio[0], (np.ndarray, list))\n        else:\n            # Single audio array or list\n            is_batched = False\n        \n        # Process audio\n        if is_batched:\n            processed_audio = [self._process_single_audio(a) for a in audio]\n        else:\n            processed_audio = [self._process_single_audio(audio)]","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/microsoft/VibeVoice/blob/94da20d98b2fa7688e9cbfaf7692ddb4954f7600/vibevoice/processor/vibevoice_tokenizer_processor.py#L141-L177","documentation":"When __call__ receives a Python list, it immediately requires it to be non-empty. An empty list cannot be dispatched (the code inspects audio[0] to distinguish paths from arrays), so it fails fast instead of indexing out of bounds or silently returning an empty batch.","triggerScenarios":"Calling processor(audio=[]) — e.g. a manifest-driven pipeline filtered out all files for a shard, or a batch loader dropped failed items and returned [].","commonSituations":"Batch inference loops over dataset shards where one shard ends up empty after filtering; error-handling code that collects successfully loaded audio and sometimes collects nothing; placeholder code awaiting real data.","solutions":["Skip the call when the batch is empty: if not audio_list: continue.","Fix upstream filters/loaders that can produce zero items so empty batches are surfaced as their own error.","For single-item cases, pass the item directly rather than a one-or-zero-element list."],"exampleFix":"# before\nenc = processor(audio=loaded)  # loaded == [] after filter\n\n# after\nif not loaded:\n    continue\nenc = processor(audio=loaded)","handlingStrategy":"validation","validationCode":"if isinstance(audio, list) and len(audio) == 0:\n    raise ValueError('empty audio batch — upstream filter removed all items')\nenc = tokenizer_processor(audio=audio)","typeGuard":"def is_nonempty_audio_batch(audio) -> bool:\n    return not isinstance(audio, list) or len(audio) > 0","tryCatchPattern":"try:\n    enc = tokenizer_processor(audio=batch)\nexcept ValueError as e:\n    if 'Empty audio list' in str(e):\n        logger.warning('skipping empty batch')\n        return None\n    raise","preventionTips":["Guard batch loops with `if not batch: continue`.","Make load-failure handling skip the whole batch rather than returning a partial-empty list silently.","Distinguish 'zero valid items after filtering' from 'load error' in data pipelines."],"tags":["audio","batch","validation","edge-case"],"backgroundTag":null,"analyzedSha":"94da20d98b2fa7688e9cbfaf7692ddb4954f7600","analyzedAt":"2026-08-15T04:12:07.418Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}