{"record":{"id":"7b70f98f7fb51982","repo":"deepfakes/faceswap","slug":"unhandled-job-self-args-job-this-is-a-bug-pl","errorCode":null,"errorMessage":"Unhandled job: {self._args.job}. This is a bug. Please report to the developers","messagePattern":"Unhandled job: (.+?)\\. This is a bug\\. Please report to the developers","errorType":"exception","errorClass":"FaceswapError","httpStatus":null,"severity":"error","filePath":"tools/alignments/alignments.py","lineNumber":195,"sourceCode":"        elif job in self._requires_frames:  # Jobs that require a frames folder\n            retval = self._get_frames_locations()\n\n        elif job in self._requires_faces and job not in self._requires_frames:\n            # Jobs that require faces as input\n            faces = [os.path.join(self._args.faces_dir, folder)\n                     for folder in os.listdir(self._args.faces_dir)\n                     if os.path.isdir(os.path.join(self._args.faces_dir, folder))]\n            if not faces:\n                logger.error(\"No folders found in '%s'\", self._args.faces_dir)\n                sys.exit(1)\n\n            retval = {\"faces_dir\": faces,\n                      \"frames_dir\": [None for _ in range(len(faces))],\n                      \"alignments_file\": [None for _ in range(len(faces))]}\n            logger.info(\"Batch mode selected. Processing faces: %s\",\n                        [os.path.basename(folder) for folder in faces])\n        else:\n            raise FaceswapError(f\"Unhandled job: {self._args.job}. This is a bug. Please report \"\n                                \"to the developers\")\n\n        logger.debug(\"File locations: %s\", retval)\n        return retval\n\n    @staticmethod\n    def _run_process(arguments) -> None:\n        \"\"\" The alignements tool process to be run in a spawned process.\n\n        In some instances, batch-mode memory leaks. Launching each job in a separate process\n        prevents this leak.\n\n        Parameters\n        ----------\n        arguments: :class:`argparse.Namespace`\n            The :mod:`argparse` arguments to be used for the given job\n        \"\"\"\n        logger.debug(\"Starting process: (arguments: %s)\", arguments)","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/deepfakes/faceswap/blob/f530cb7508ae670f6474f8a7d9c4df94705cf96b/tools/alignments/alignments.py#L177-L213","documentation":"Internal invariant in the Alignments tool's file-location resolution: self._args.job is not one of the handled jobs (the branches above cover the normal jobs plus batch mode over a faces dir). Reaching the else means the job dispatcher and the location resolver got out of sync — a developer bug, not a user-input problem.","triggerScenarios":"Passing an alignments job string that the CLI accepted but _get_locations does not branch on, or a new job added to the parser without a matching branch here. Not reachable through documented user flags on a released version.","commonSituations":"Local modifications/forks adding a job to the arg parser but not to this resolver; passing a job alias that only the GUI understands; version skew after a partial update.","solutions":["If you are a plain user, report the issue to the Faceswap developers with the exact command line and version (`python tools.py alignments -h` output).","If you maintain a fork, add a matching branch for the new job in _get_locations or route it through the batch-mode path.","Retry with a canonical job name from `python tools.py alignments -h`."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"VALID_JOBS = {\"extract\", \"sort\", \"multi-as-one\"}  # adapt from `tools.py alignments -h`\ndef is_supported_job(job: str) -> bool:\n    return job in VALID_JOBS","typeGuard":"def assert_known_alignments_job(job: str) -> None:\n    \"\"\"Narrow the job string to the set _get_locations handles.\"\"\"\n    handled = {...}  # mirror the branches in tools/alignments/alignments.py\n    assert job in handled, f\"Unsupported alignments job: {job}\"","tryCatchPattern":"from lib.exceptions import FaceswapError\ntry:\n    locs = get_locations(arguments)\nexcept FaceswapError as err:\n    if \"Unhandled job\" in str(err):\n        # developer bug: file upstream with command line + version\n        ...","preventionTips":["Keep the job enum and the resolver branches in one module or generate both from a single table.","Add unit tests enumerating every CLI job through _get_locations so new jobs cannot skip the resolver."],"tags":["faceswap","alignments","internal-bug","dispatch"],"backgroundTag":null,"analyzedSha":"f530cb7508ae670f6474f8a7d9c4df94705cf96b","analyzedAt":"2026-08-15T02:59:26.626Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}