deepfakes/faceswap · error · FaceswapError

The location '{self.location}' does not exist

Error message

The location '{self.location}' does not exist

What it means

FaceswapError raised by the ImagesIO base class (_check_location_exists) when a single input location (folder or video file) passed as the path argument does not exist on disk. It is a fail-fast guard before the background load/save thread starts.

Source

Thrown at lib/image.py:795

        self._queue = Queue(maxsize=queue_size)
        self._thread = None
        self._error_state: ErrorState | None = None

    @property
    def location(self):
        """ str: The folder or video that was passed in as the :attr:`path` parameter. """
        return self._location

    def _check_location_exists(self):
        """ Check whether the input location exists.

        Raises
        ------
        FaceswapError
            If the given location does not exist
        """
        if isinstance(self.location, str) and not os.path.exists(self.location):
            raise FaceswapError(f"The location '{self.location}' does not exist")
        if isinstance(self.location, (list, tuple)) and not all(os.path.exists(location)
                                                                for location in self.location):
            raise FaceswapError("Not all locations in the input list exist")

    def _set_thread(self):
        """ Set the background thread for the load and save iterators and launch it. """
        logger.trace("[%s] Setting thread", self._name)  # type:ignore[attr-defined]
        if self._thread is not None and self._thread.is_alive():
            logger.trace("[%s] Thread pre-exists and is alive: %s",  # type:ignore[attr-defined]
                         self._name, self._thread)
            return
        self._thread = FSThread(self._process,
                                name=self.__class__.__name__,
                                args=(self._queue, ))
        self._error_state = self._thread.error_state
        logger.debug("[%s] Set thread: %s", self._name, self._thread)
        self._thread.start()

View on GitHub (pinned to f530cb7508)

Solutions

  1. Correct the path; verify with ls or os.path.exists before launching.
  2. Use absolute paths for input locations.
  3. If the input is on a network/external drive, confirm it is mounted before running.

Example fix

import os

# before
loader = ImagesLoader('/data/face_src')  # FaceswapError if missing

# after
assert os.path.exists('/data/face_src'), 'input folder missing'
loader = ImagesLoader('/data/face_src')
Defensive patterns

Strategy: validation

Validate before calling

import os

if not os.path.exists(location):
    raise SystemExit(f'input location does not exist: {location}')
loader = ImagesLoader(location)

Try / catch

try:
    loader = ImagesLoader(path)
except FaceswapError as err:
    if 'does not exist' in str(err):
        path = prompt_user_for_valid_path()
        loader = ImagesLoader(path)
    else:
        raise

Prevention

When it happens

Trigger: Constructing ImagesLoader (or subclass) with a typo'd path, a path on an unmounted drive, or a video file that was moved/deleted between argument validation and use.

Common situations: Typos in CLI -i/--input arguments, relative paths run from a different working directory, network mounts not yet attached, case-sensitive path mismatches on Linux after copying from Windows.

Related errors


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