{"record":{"id":"f7c443c51c883d38","repo":"deepfakes/faceswap","slug":"plugin-type-is-not-a-valid-plugin-type-select-f","errorCode":null,"errorMessage":"{plugin_type} is not a valid plugin type. Select from {list(cls.extract_plugins)}","messagePattern":"(.+?) is not a valid plugin type\\. Select from (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"plugins/plugin_loader.py","lineNumber":99,"sourceCode":"\n        Parameters\n        ----------\n        type\n            The type of extractor plugin to obtain\n        name\n            The name of the requested extractor plugin\n\n        Returns\n        -------\n        An extraction plugin\n\n        Raises\n        ------\n        ValueError\n            If an invalid plugin type or plugin name is selected\n        \"\"\"\n        if plugin_type not in cls.extract_plugins:\n            raise ValueError(f\"{plugin_type} is not a valid plugin type. Select from \"\n                             f\"{list(cls.extract_plugins)}\")\n        plugins = cls.extract_plugins[plugin_type]\n        mods = [p.split(\".\")[-2] for p in plugins]\n        real_name = name.lower().replace(\"-\", \"_\")\n        if real_name not in mods:\n            raise ValueError(f\"{name} is not a valid {plugin_type} plugin. Select from {mods}\")\n\n        mod, obj = plugins[mods.index(real_name)].rsplit(\".\", maxsplit=1)\n        logger.debug(\"Loading '%s' from '%s'\", plugin_type, name)\n\n        module = import_module(mod)\n\n        retval = getattr(module, obj)()\n        logger.info(\"Loading %s from %s\", plugin_type.title(), retval.name)\n        return retval\n\n    @staticmethod\n    def get_model(name: str, disable_logging: bool = False) -> type[ModelBase]:","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/deepfakes/faceswap/blob/f530cb7508ae670f6474f8a7d9c4df94705cf96b/plugins/plugin_loader.py#L81-L117","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use one of the types printed in the error: the keys of cls.extract_plugins (align, detect, mask, recognition).","Check for typos and singular/plural or noun-form mismatches ('detector' vs 'detect').","Prefer the higher-level API (e.g. Extractor or the pipeline classes) instead of calling PluginLoader directly."],"exampleFix":"# before\nplugin = PluginLoader.get_extractor('detector', 's3fd')\n\n# after\nplugin = PluginLoader.get_extractor('detect', 's3fd')","handlingStrategy":"type-guard","validationCode":"from plugins.plugin_loader import PluginLoader\nptype = \"detect\"\nassert ptype in PluginLoader.extract_plugins, f\"pick from {list(PluginLoader.extract_plugins)}\"","typeGuard":"from typing import Literal\nPluginType = Literal[\"align\", \"detect\", \"mask\", \"recognition\"]\ndef is_valid_plugin_type(ptype: str) -> bool:\n    from plugins.plugin_loader import PluginLoader\n    return ptype in PluginLoader.extract_plugins","tryCatchPattern":null,"preventionTips":["Use the Literal/registry keys rather than free-form strings when scripting against PluginLoader.","Prefer the high-level pipeline APIs; they choose the plugin type for you."],"tags":["faceswap","plugin-loader","api-misuse","validation"],"backgroundTag":null,"analyzedSha":"f530cb7508ae670f6474f8a7d9c4df94705cf96b","analyzedAt":"2026-08-15T02:59:26.626Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}