{"record":{"id":"5f582b24f9bfd885","repo":"deepfakes/faceswap","slug":"you-have-selected-the-mask-type-mask-type-but","errorCode":null,"errorMessage":"You have selected the mask type '{mask_type}' but at least one face does not contain the selected mask.\\nThe face that failed was: '{filename}'\\n{msg}","messagePattern":"You have selected the mask type '(.+?)' but at least one face does not contain the selected mask\\.\\\\nThe face that failed was: '(.+?)'\\\\n(.+?)","errorType":"exception","errorClass":"FaceswapError","httpStatus":null,"severity":"error","filePath":"lib/training/data/data_set.py","lineNumber":169,"sourceCode":"        masks\n            The list of mask keys that exist for the currently processing face\n        mask_type\n            The requested mask type\n        filename\n            The name of the extracted face file currently being processed\n\n        Raises\n        ------\n        FaceswapError\n            If the requested mask type is not available an error is returned along with a list\n            of available masks\n        \"\"\"\n        exist_masks = masks + list(self._lm_masks)\n        if mask_type in exist_masks:\n            return\n        msg = (f\"The masks that exist for this face are: {exist_masks}\" if exist_masks\n               else \"No masks exist for this face\")\n        raise FaceswapError(\n            f\"You have selected the mask type '{mask_type}' but at least one \"\n            \"face does not contain the selected mask.\\n\"\n            f\"The face that failed was: '{filename}'\\n{msg}\")\n\n    def _get_landmarks_mask(self,\n                            mask_type: T.Literal[\"face\", \"face_extended\", \"eye\", \"mouth\"],\n                            aligned: AlignedFace) -> npt.NDArray[np.uint8]:\n        \"\"\"Obtain a landmarks based mask directly from the aligned face object\n\n        Parameters\n        ----------\n        mask_type\n            The type of landmarks based mask to obtain\n        aligned\n            The aligned face object to obtain the mask from\n\n        Returns\n        -------","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/deepfakes/faceswap/blob/f530cb7508ae670f6474f8a7d9c4df94705cf96b/lib/training/data/data_set.py#L151-L187","documentation":"Thrown by the training DataSet when the mask type chosen in the training configuration does not exist for at least one face in the alignments data. Faceswap stores masks inside the faceswap alignments file (produced by the extraction pipeline), so this error means the requested mask was never generated (or was generated only for some faces) for the offending face.","triggerScenarios":"Starting a training session with cfg.Mask.mask_type set to a mask (e.g. 'bisenet-fp', 'vgg-clear', 'custom') that is not present in the masks list of at least one aligned face. The check runs per-face via the mask validation routine in lib/training/data/data_set.py during dataset build, before training begins.","commonSituations":"User ran extraction/masking with one mask plugin but configured training to use a different one; user re-extracted faces or deleted alignments without regenerating masks; older alignments files created before a mask plugin existed; using a landmarks-based mask name that is not in self._lm_masks ('face', 'face_extended', 'eye', 'mouth').","solutions":["Set the training config (go to 'Train' config in the GUI or edit the training config file) Mask > mask_type to a mask that is listed in the error message as existing for the faces (or to 'none' to train without a mask).","If the mask you want is missing, generate it by re-running the mask job: faceswap mask -a <alignments> -i <faces folder> -M <mask_type> before training.","Re-run alignment/extraction with the mask plugin enabled so all faces carry the mask.","If only a few faces fail (the filename is printed), regenerate masks for that subset or remove the offending face from the training folder."],"exampleFix":"# before (training config)\n[mask.mask_type] = bisenet-fp-head  # not present in alignments\n\n# after: use a mask that exists (error message lists them)\n[mask.mask_type] = vgg-clear\n# or regenerate the missing mask first:\n# faceswap mask -i faces/ -a faces/alignments.fsa -M bisenet-fp --include-hair","handlingStrategy":"validation","validationCode":"from lib.serializer import get_serializer\nfrom lib.align.alignments import AlignmentFileCache  # faceswap's alignments access\n# Easiest pre-check: the CLI/GUI 'mask' job lists existing masks, or:\n# faceswap mask -a alignments.fsa -i faces/ (shows what exists)\n# Programmatically, confirm the chosen mask exists for every face before training:\nimport lib.align.animations  # noqa ensure loaded\nfrom lib.align.aligned_face import AlignedFace\n# pseudo: iterate alignments and check mask storage keys\n# for face in alignments.faces: assert mask_type in face.mask.stored_masks","typeGuard":"def mask_exists(mask_type: str, stored_mask_types: list[str], lm_masks: tuple[str,...] = (\"face\",\"face_extended\",\"eye\",\"mouth\")) -> bool:\n    return mask_type in stored_mask_types or mask_type in lm_masks","tryCatchPattern":null,"preventionTips":["Always generate masks in the extraction pipeline with the same mask plugin you will train with.","Keep the training config's mask_type in sync with the masks actually stored in your alignments file.","After re-extraction, re-check available masks with the 'mask' job before launching training."],"tags":["faceswap","mask","training","configuration","alignments"],"backgroundTag":null,"analyzedSha":"f530cb7508ae670f6474f8a7d9c4df94705cf96b","analyzedAt":"2026-08-15T02:59:26.626Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}