deepfakes/faceswap · error · ValueError

{plugin_type} is not a valid plugin type. Select from {list(

Error message

{plugin_type} is not a valid plugin type. Select from {list(cls.extract_plugins)}

What it means

Raised by PluginLoader.get_extractor when the plugin_type argument is not a key of the extract_plugins registry (which maps categories like 'align', 'detect', 'mask', 'recognition' to their plugin modules). It is a programming/config-level ValueError: the valid types are fixed by the codebase.

Source

Thrown at plugins/plugin_loader.py:99

        Parameters
        ----------
        type
            The type of extractor plugin to obtain
        name
            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]:

View on GitHub (pinned to f530cb7508)

Solutions

  1. Use one of the types printed in the error: the keys of cls.extract_plugins (align, detect, mask, recognition).
  2. Check for typos and singular/plural or noun-form mismatches ('detector' vs 'detect').
  3. Prefer the higher-level API (e.g. Extractor or the pipeline classes) instead of calling PluginLoader directly.

Example fix

# before
plugin = PluginLoader.get_extractor('detector', 's3fd')

# after
plugin = PluginLoader.get_extractor('detect', 's3fd')
Defensive patterns

Strategy: type-guard

Validate before calling

from plugins.plugin_loader import PluginLoader
ptype = "detect"
assert ptype in PluginLoader.extract_plugins, f"pick from {list(PluginLoader.extract_plugins)}"

Type guard

from typing import Literal
PluginType = Literal["align", "detect", "mask", "recognition"]
def is_valid_plugin_type(ptype: str) -> bool:
    from plugins.plugin_loader import PluginLoader
    return ptype in PluginLoader.extract_plugins

Prevention

When it happens

Trigger: Calling PluginLoader.get_extractor('invalid_type', ...) — e.g. 'alignment' instead of 'align', 'detector' instead of 'detect' — from custom scripts, or from a GUI/CLI code path fed an unexpected string.

Common situations: Third-party scripts or user plugins calling PluginLoader directly with a wrong category name; code written against an older version where names differed; casing/typo mistakes.

Related errors


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