deezer/spleeter · error · SpleeterError

Separated source path conflict : {path},please check your fi

Error message

Separated source path conflict : {path},please check your filename format

What it means

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.

Source

Thrown at spleeter/separator.py:333

            audio_adapter = AudioAdapter.default()
        foldername = basename(dirname(audio_descriptor))
        filename = splitext(basename(audio_descriptor))[0]
        generated = []
        for instrument, data in sources.items():
            path = join(
                destination,
                filename_format.format(
                    filename=filename,
                    instrument=instrument,
                    foldername=foldername,
                    codec=codec,
                ),
            )
            directory = os.path.dirname(path)
            if not os.path.exists(directory):
                os.makedirs(directory)
            if path in generated:
                raise SpleeterError(
                    (
                        f"Separated source path conflict : {path},"
                        "please check your filename format"
                    )
                )
            generated.append(path)
            if self._pool:
                task = self._pool.apply_async(
                    audio_adapter.save, (path, data, self._sample_rate, codec, bitrate)
                )
                self._tasks.append(task)
            else:
                audio_adapter.save(path, data, self._sample_rate, codec, bitrate)
        if synchronous and self._pool:
            self.join()

View on GitHub (pinned to c8854001ac)

Solutions

  1. Include {instrument} in filename_format so each stem gets a unique path, e.g. '{filename}/{instrument}.{codec}'
  2. Also include {filename} when separating multiple input files into one output directory
  3. If you intentionally want to overwrite, reset/clear the generated list or call separate_to_file with a fresh separator/output dir per run
  4. On case-insensitive filesystems, make sure names differ by more than letter case

Example fix

// before
separator.separate_to_file('song.mp3', 'out', filename_format='out/song.{codec}')
// after
separator.separate_to_file('song.mp3', 'out', filename_format='out/{filename}/{instrument}.{codec}')
Defensive patterns

Strategy: validation

Validate before calling

from spleeter.utils.utils import get_filename_format  # or format manually

def format_is_unique(fmt: str, instruments, filenames=('a', 'b')) -> bool:
    paths = set()
    for fn in filenames:
        for inst in instruments:
            p = fmt.format(filename=fn, instrument=inst, codec='wav')
            if p in paths:
                return False
            paths.add(p)
    return True

assert format_is_unique('{filename}/{instrument}.{codec}', ['vocals', 'accompaniment'])

Try / catch

from spleeter import SpleeterError
try:
    separator.separate_to_file(audio, outdir, filename_format=fmt)
except SpleeterError as e:
    if 'path conflict' in str(e):
        print(f'filename_format {fmt!r} maps multiple stems to one path; add {{instrument}}')
    else:
        raise

Prevention

When it happens

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

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

Related errors


AI-assisted analysis of deezer/spleeter@c8854001ac (2026-08-28). Data as JSON: /api/errors/89beb9da2027ade9. Report an issue: GitHub.