deepfakes/faceswap · error · ValueError

{name} is not a valid {plugin_type} plugin. Select from {mod

Error message

{name} is not a valid {plugin_type} plugin. Select from {mods}

What it means

Raised by PluginLoader.get_extractor after the type check passes but the requested plugin name (lower-cased, hyphens converted to underscores) is not among the discovered modules for that type. The module list is built from the files present in the plugins/extract/<type>/ folder, so a name that is not shipped (or not found on disk) fails here.

Source

Thrown at plugins/plugin_loader.py:105

            The name of the requested extractor plugin

        Returns
        -------
        An extraction plugin

        Raises
        ------
        ValueError
            If an invalid plugin type or plugin name is selected
        """
        if plugin_type not in cls.extract_plugins:
            raise ValueError(f"{plugin_type} is not a valid plugin type. Select from "
                             f"{list(cls.extract_plugins)}")
        plugins = cls.extract_plugins[plugin_type]
        mods = [p.split(".")[-2] for p in plugins]
        real_name = name.lower().replace("-", "_")
        if real_name not in mods:
            raise ValueError(f"{name} is not a valid {plugin_type} plugin. Select from {mods}")

        mod, obj = plugins[mods.index(real_name)].rsplit(".", maxsplit=1)
        logger.debug("Loading '%s' from '%s'", plugin_type, name)

        module = import_module(mod)

        retval = getattr(module, obj)()
        logger.info("Loading %s from %s", plugin_type.title(), retval.name)
        return retval

    @staticmethod
    def get_model(name: str, disable_logging: bool = False) -> type[ModelBase]:
        """Return requested training model plugin

        Parameters
        ----------
        name
            The name of the requested training model plugin

View on GitHub (pinned to f530cb7508)

Solutions

  1. Pick a name from the list printed in the error message (mods for that type).
  2. If using a third-party plugin, install its module file into the correct plugins/extract/<type>/ directory.
  3. Spell the name as shipped — hyphens and underscores are normalized, but the word itself must match the module folder.

Example fix

# before
plugin = PluginLoader.get_extractor('align', 'dlib')

# after
plugin = PluginLoader.get_extractor('align', 'fan')  # a shipped aligner
Defensive patterns

Strategy: type-guard

Validate before calling

from plugins.plugin_loader import PluginLoader
mods = [p.split(".")[-2] for p in PluginLoader.extract_plugins["detect"]]
assert "s3fd" in mods, f"pick from {mods}"

Type guard

def is_valid_plugin(name: str, ptype: str) -> bool:
    from plugins.plugin_loader import PluginLoader
    mods = [p.split(".")[-2] for p in PluginLoader.extract_plugins[ptype]]
    return name.lower().replace("-", "_") in mods

Prevention

When it happens

Trigger: Requesting e.g. get_extractor('detect', 'retina-mobile') when only s3fd/mtcnn/etc. modules exist; passing a plugin name from a different Faceswap version or a third-party plugin that was not installed into the plugins folder.

Common situations: Tutorials referencing plugins that no longer exist or were renamed; custom plugin file not placed in plugins/extract/<type>/; typos or wrong case/hyphenation in the name.

Related errors


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