{"record":{"id":"89beb9da2027ade9","repo":"deezer/spleeter","slug":"separated-source-path-conflict-path-please-che","errorCode":null,"errorMessage":"Separated source path conflict : {path},please check your filename format","messagePattern":"Separated source path conflict : (.+?),please check your filename format","errorType":"exception","errorClass":"SpleeterError","httpStatus":null,"severity":"error","filePath":"spleeter/separator.py","lineNumber":333,"sourceCode":"            audio_adapter = AudioAdapter.default()\n        foldername = basename(dirname(audio_descriptor))\n        filename = splitext(basename(audio_descriptor))[0]\n        generated = []\n        for instrument, data in sources.items():\n            path = join(\n                destination,\n                filename_format.format(\n                    filename=filename,\n                    instrument=instrument,\n                    foldername=foldername,\n                    codec=codec,\n                ),\n            )\n            directory = os.path.dirname(path)\n            if not os.path.exists(directory):\n                os.makedirs(directory)\n            if path in generated:\n                raise SpleeterError(\n                    (\n                        f\"Separated source path conflict : {path},\"\n                        \"please check your filename format\"\n                    )\n                )\n            generated.append(path)\n            if self._pool:\n                task = self._pool.apply_async(\n                    audio_adapter.save, (path, data, self._sample_rate, codec, bitrate)\n                )\n                self._tasks.append(task)\n            else:\n                audio_adapter.save(path, data, self._sample_rate, codec, bitrate)\n        if synchronous and self._pool:\n            self.join()\n","sourceCodeStart":315,"sourceCodeEnd":349,"githubUrl":"https://github.com/deezer/spleeter/blob/c8854001ac8acad34a9bc2bd15f28475541828b1/spleeter/separator.py#L315-L349","documentation":"save_to_file tracks every output path it writes into a shared `generated` list and raises SpleeterError when the same path is produced twice within one separation run. Duplicate paths usually mean your filename_format pattern expands to the same file for two different output stems (e.g. missing the {instrument} placeholder), so one output would silently overwrite another. Spleeter aborts instead of losing audio.","triggerScenarios":"Calling separate_to_file (or separate_to_file witn multiple instruments) with a filename_format such as 'output/{filename}.{codec}' that omits {instrument}, so each stem maps to the identical path and the second write hits `path in generated`.","commonSituations":"Custom filename_format strings missing the {instrument} variable; batch jobs processing many files where the format also omits {filename}, colliding across inputs; copying an example format and editing it incorrectly; case-insensitive filesystems collapsing paths that look distinct.","solutions":["Include {instrument} in filename_format so each stem gets a unique path, e.g. '{filename}/{instrument}.{codec}'","Also include {filename} when separating multiple input files into one output directory","If you intentionally want to overwrite, reset/clear the generated list or call separate_to_file with a fresh separator/output dir per run","On case-insensitive filesystems, make sure names differ by more than letter case"],"exampleFix":"// before\nseparator.separate_to_file('song.mp3', 'out', filename_format='out/song.{codec}')\n// after\nseparator.separate_to_file('song.mp3', 'out', filename_format='out/{filename}/{instrument}.{codec}')","handlingStrategy":"validation","validationCode":"from spleeter.utils.utils import get_filename_format  # or format manually\n\ndef format_is_unique(fmt: str, instruments, filenames=('a', 'b')) -> bool:\n    paths = set()\n    for fn in filenames:\n        for inst in instruments:\n            p = fmt.format(filename=fn, instrument=inst, codec='wav')\n            if p in paths:\n                return False\n            paths.add(p)\n    return True\n\nassert format_is_unique('{filename}/{instrument}.{codec}', ['vocals', 'accompaniment'])","typeGuard":null,"tryCatchPattern":"from spleeter import SpleeterError\ntry:\n    separator.separate_to_file(audio, outdir, filename_format=fmt)\nexcept SpleeterError as e:\n    if 'path conflict' in str(e):\n        print(f'filename_format {fmt!r} maps multiple stems to one path; add {{instrument}}')\n    else:\n        raise","preventionTips":["Always include {instrument} in filename_format for multichannel separation","Include {filename} when batching multiple inputs to the same output root","Keep one Separator run per output directory, or clean `generated` between runs","Test your format string against all stems before running large batch jobs"],"tags":["filename-format","path-conflict","spleetererror","configuration"],"backgroundTag":"output-path-collision","analyzedSha":"c8854001ac8acad34a9bc2bd15f28475541828b1","analyzedAt":"2026-08-28T21:38:40.142Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}