{"record":{"id":"d9172134daa16948","repo":"deepfakes/faceswap","slug":"the-destination-archive-folder-dst-path-alread","errorCode":null,"errorMessage":"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}'.","messagePattern":"The destination archive folder '(.+?)' already exists\\. Either delete this folder, select a different model folder, or remove the legacy model files from your model folder '(.+?)'\\.","errorType":"exception","errorClass":"FaceswapError","httpStatus":null,"severity":"error","filePath":"plugins/train/model/_base/update.py","lineNumber":301,"sourceCode":"            self._process_deprecations(layer)\n            self._process_inbounds(layer[\"name\"], layer[\"inbound_nodes\"])\n\n    def _archive_model(self) -> str:\n        \"\"\"Archive an existing Keras 2 model to a new archive location\n\n        Raises\n        ------\n        FaceswapError\n            If the destination archive folder exists and is not empty\n\n        Returns\n        -------\n        The path to the archived keras 2 model folder\n        \"\"\"\n        model_dir = os.path.dirname(self._old_model_file)\n        dst_path = f\"{model_dir}_fs2_backup\"\n        if os.path.exists(dst_path) and os.listdir(dst_path):\n            raise FaceswapError(\n                f\"The destination archive folder '{dst_path}' already exists. Either delete this \"\n                \"folder, select a different model folder, or remove the legacy model files from \"\n                f\"your model folder '{model_dir}'.\")\n\n        if os.path.exists(dst_path):\n            logger.info(\"Removing pre-existing empty folder '%s'\", dst_path)\n            os.rmdir(dst_path)\n\n        logger.info(\"Archiving model folder '%s' to '%s'\", model_dir, dst_path)\n        os.rename(model_dir, dst_path)\n        return dst_path\n\n    def _restore_files(self, archive_dir: str) -> None:\n        \"\"\"Copy the state.json file and the logs folder from the archive folder to the new model\n        folder\n\n        Parameters\n        ----------","sourceCodeStart":283,"sourceCodeEnd":319,"githubUrl":"https://github.com/deepfakes/faceswap/blob/f530cb7508ae670f6474f8a7d9c4df94705cf96b/plugins/train/model/_base/update.py#L283-L319","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["If the earlier port succeeded, delete or archive the '<model_dir>_fs2_backup' folder and re-run","If the earlier port failed midway, restore needed files from the backup, then remove it before retrying","Alternatively move your legacy model folder to a fresh path and port from there"],"exampleFix":"# before\nrm -rf /models/my_model_fs2_backup  # careful: verify contents first\npython tools.py port -m /models/my_model\n\n# same code, but note: verify the backup is disposable before deleting it","handlingStrategy":"validation","validationCode":"import os\nbackup = f\"{model_dir}_fs2_backup\"\nif os.path.isdir(backup) and os.listdir(backup):\n    raise SystemExit(f\"Non-empty backup {backup} exists; move or delete it before porting\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["After any port attempt (success or failure), clean or archive the _fs2_backup folder before the next run","Script your ports so cleanup happens in a finally block"],"tags":["faceswap","migration","filesystem","backup"],"backgroundTag":null,"analyzedSha":"f530cb7508ae670f6474f8a7d9c4df94705cf96b","analyzedAt":"2026-08-15T02:59:26.626Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}