deepfakes/faceswap · error · FaceswapError

The destination archive folder '{dst_path}' already exists.

Error message

The destination archive folder '{dst_path}' already exists. Either delete this folder, select a different model folder, or remove the legacy model files from your model folder '{model_dir}'.

What it means

FaceswapError raised during model porting backup: before moving the legacy model folder to '<model_dir>_fs2_backup', the code checks that the destination either does not exist or is empty. A non-empty backup folder already present means the rename would clobber existing data, so the port aborts. The message tells you to delete, relocate, or clean the folder.

Source

Thrown at plugins/train/model/_base/update.py:301

            self._process_deprecations(layer)
            self._process_inbounds(layer["name"], layer["inbound_nodes"])

    def _archive_model(self) -> str:
        """Archive an existing Keras 2 model to a new archive location

        Raises
        ------
        FaceswapError
            If the destination archive folder exists and is not empty

        Returns
        -------
        The path to the archived keras 2 model folder
        """
        model_dir = os.path.dirname(self._old_model_file)
        dst_path = f"{model_dir}_fs2_backup"
        if os.path.exists(dst_path) and os.listdir(dst_path):
            raise FaceswapError(
                f"The destination archive folder '{dst_path}' already exists. Either delete this "
                "folder, select a different model folder, or remove the legacy model files from "
                f"your model folder '{model_dir}'.")

        if os.path.exists(dst_path):
            logger.info("Removing pre-existing empty folder '%s'", dst_path)
            os.rmdir(dst_path)

        logger.info("Archiving model folder '%s' to '%s'", model_dir, dst_path)
        os.rename(model_dir, dst_path)
        return dst_path

    def _restore_files(self, archive_dir: str) -> None:
        """Copy the state.json file and the logs folder from the archive folder to the new model
        folder

        Parameters
        ----------

View on GitHub (pinned to f530cb7508)

Solutions

  1. If the earlier port succeeded, delete or archive the '<model_dir>_fs2_backup' folder and re-run
  2. If the earlier port failed midway, restore needed files from the backup, then remove it before retrying
  3. Alternatively move your legacy model folder to a fresh path and port from there

Example fix

# before
rm -rf /models/my_model_fs2_backup  # careful: verify contents first
python tools.py port -m /models/my_model

# same code, but note: verify the backup is disposable before deleting it
Defensive patterns

Strategy: validation

Validate before calling

import os
backup = f"{model_dir}_fs2_backup"
if os.path.isdir(backup) and os.listdir(backup):
    raise SystemExit(f"Non-empty backup {backup} exists; move or delete it before porting")

Prevention

When it happens

Trigger: Running the porting routine a second time (or after a failed run) while <model_dir>_fs2_backup still contains files. os.path.exists(dst) and os.listdir(dst) are both true.

Common situations: A previous port partially completed and left files in the backup; the user re-runs porting without cleaning up; two different model folders share the same backup location.

Related errors


AI-assisted analysis of deepfakes/faceswap@f530cb7508 (2026-08-15). Data as JSON: /api/errors/d9172134daa16948. Report an issue: GitHub.