{"record":{"id":"feaba948298d8e7d","repo":"deepfakes/faceswap","slug":"frame-ranges-not-specified-in-the-correct-format","errorCode":null,"errorMessage":"Frame Ranges not specified in the correct format","messagePattern":"Frame Ranges not specified in the correct format","errorType":"exception","errorClass":"FaceswapError","httpStatus":null,"severity":"error","filePath":"scripts/convert.py","lineNumber":434,"sourceCode":"\n        min_frame, max_frame = None, None\n        if self._images.is_video:\n            min_frame, max_frame = 1, self._images.count\n        else:\n            indices = [int(self._image_idx_re.findall(os.path.basename(filename))[0])\n                       for filename in self._images.file_list]\n            if indices:\n                min_frame, max_frame = min(indices), max(indices)\n        logger.debug(\"min_frame: %s, max_frame: %s\", min_frame, max_frame)\n\n        if min_frame is None or max_frame is None:\n            raise FaceswapError(\"Frame Ranges specified, but could not determine frame numbering \"\n                                \"from filenames\")\n\n        retval = []\n        for rng in self._args.frame_ranges:\n            if \"-\" not in rng:\n                raise FaceswapError(\"Frame Ranges not specified in the correct format\")\n            start, end = rng.split(\"-\")\n            retval.append((max(int(start), min_frame), min(int(end), max_frame)))\n        logger.debug(\"frame ranges: %s\", retval)\n        return retval\n\n    def _load_extractor(self) -> ExtractRunner[ExtractHandler] | None:\n        \"\"\"Load the CV2-DNN Face Extractor Chain.\n\n        For On-The-Fly conversion we use a CPU based extractor to avoid stacking the GPU.\n        Results are poor.\n\n        Returns\n        -------\n        The face extraction chain to be used for on-the-fly conversion\n        \"\"\"\n        if not self._alignments.have_alignments_file and not self._args.on_the_fly:\n            logger.error(\"No alignments file found. Please provide an alignments file for your \"\n                         \"destination video (recommended) or enable on-the-fly conversion (not \"","sourceCodeStart":416,"sourceCodeEnd":452,"githubUrl":"https://github.com/deepfakes/faceswap/blob/f530cb7508ae670f6474f8a7d9c4df94705cf96b/scripts/convert.py#L416-L452","documentation":"FaceswapError raised in Convert._get_frame_ranges when a --frame-ranges value contains no '-' separator. Each range must be 'start-end'; the code splits on '-' and would fail unpacking without it, so it fails fast with a clear message instead of a ValueError. Everything before this check (index detection) has already succeeded.","triggerScenarios":"Passing --frame-ranges 5 (single number), --frame-ranges 5,10 (comma format), or a typo like '--frame-ranges 5-10-15' variant without dash. rng lacks '-' so the guard fires.","commonSituations":"User assumes comma syntax from other tools, forgets the end value, or has a shell quoting issue that drops part of the range.","solutions":["Format each range as START-END, e.g. --frame-ranges 5-10","Multiple ranges separated by commas: --frame-ranges 1-100,200-300","Check shell quoting so the full argument reaches the parser"],"exampleFix":"# before\npython faceswap.py convert ... --frame-ranges 5\npython faceswap.py convert ... --frame-ranges 5,10\n\n# after\npython faceswap.py convert ... --frame-ranges 5-10\npython faceswap.py convert ... --frame-ranges 1-100,200-300","handlingStrategy":"validation","validationCode":"for rng in args.frame_ranges:\n    parts = rng.split(\"-\")\n    if len(parts) != 2 or not all(p.isdigit() for p in parts):\n        raise SystemExit(f\"Bad frame range {rng!r}; expected START-END (e.g. 5-10)\")","typeGuard":"def is_valid_frame_range(rng: str) -> bool:\n    \"\"\"True if rng looks like 'START-END' with integer bounds.\"\"\"\n    parts = rng.split(\"-\")\n    return len(parts) == 2 and all(p.isdigit() for p in parts)","tryCatchPattern":null,"preventionTips":["Use the documented START-END format; separate multiple ranges with commas","Add this check to wrapper scripts that build --frame-ranges dynamically"],"tags":["faceswap","convert","frame-ranges","arguments"],"backgroundTag":null,"analyzedSha":"f530cb7508ae670f6474f8a7d9c4df94705cf96b","analyzedAt":"2026-08-15T02:59:26.626Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}