{"record":{"id":"97eebb3168e86ae0","repo":"invoke-ai/InvokeAI","slug":"no-tokenizer-2-folder-resolvable-for-this-sdnq-t5","errorCode":null,"errorMessage":"no tokenizer_2 folder resolvable for this SDNQ T5 encoder layout","messagePattern":"no tokenizer_2 folder resolvable for this SDNQ T5 encoder layout","errorType":"validation","errorClass":"NotAMatchError","httpStatus":null,"severity":"info","filePath":"invokeai/backend/model_manager/configs/t5_encoder.py","lineNumber":137,"sourceCode":"    cpu_only: bool | None = Field(default=None, description=\"Whether this model should run on CPU only\")\n\n    @classmethod\n    def from_model_on_disk(cls, mod: ModelOnDisk, override_fields: dict[str, Any]) -> Self:\n        raise_if_not_dir(mod)\n\n        raise_for_override_fields(cls, override_fields)\n\n        te_dir = cls._locate_text_encoder_dir(mod)\n        raise_for_class_name(te_dir / \"config.json\", \"T5EncoderModel\")\n\n        cls._raise_if_not_sdnq_quantized(te_dir)\n\n        # Every FLUX workflow requests a Tokenizer2 alongside the encoder, and the loader can only load\n        # it from a `tokenizer_2/` folder. Reject an install that has no resolvable tokenizer (e.g. a\n        # bare inline `text_encoder_2` folder with no sibling `tokenizer_2/`) at identification time so\n        # it never registers as a selectable T5 that then fails mid-workflow on the missing tokenizer.\n        if cls.resolve_tokenizer_dir(mod.path) is None:\n            raise NotAMatchError(\"no tokenizer_2 folder resolvable for this SDNQ T5 encoder layout\")\n\n        return cls(**override_fields)\n\n    @staticmethod\n    def resolve_text_encoder_dir(path: Path) -> Optional[Path]:\n        \"\"\"Return the directory holding T5's config.json + safetensors, or None.\n\n        Two layouts: a standalone bundle (``path`` is the pipeline root, T5 under ``text_encoder_2/``)\n        or an inline submodel (``path`` *is* the ``text_encoder_2`` folder).\n        \"\"\"\n        nested = path / \"text_encoder_2\"\n        if (nested / \"config.json\").exists():\n            return nested\n        if (path / \"config.json\").exists():\n            return path\n        return None\n\n    @staticmethod","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/configs/t5_encoder.py#L119-L155","documentation":"NotAMatchError from T5Encoder_SDNQ_Config.from_model_on_disk. Every FLUX workflow needs a Tokenizer2 that the loader can only load from a `tokenizer_2/` folder next to the encoder. An SDNQ T5 install with no resolvable tokenizer_2 directory is rejected at identification time so it never registers as a selectable T5 that would fail mid-workflow.","triggerScenarios":"from_model_on_disk on an SDNQ T5 layout where cls.resolve_tokenizer_dir(mod.path) returns None — e.g. a bare inline `text_encoder_2/` folder with no sibling `tokenizer_2/`, or tokenizer files named/moved elsewhere.","commonSituations":"Downloading only the text encoder from a FLUX repo without tokenizer_2, moving tokenizer files out of the folder, or building a minimal encoder-only install for non-FLUX use.","solutions":["Copy/download the `tokenizer_2/` folder from the source FLUX repo as a sibling of the encoder dir","Re-download the complete model repo including tokenizer_2 files","If the model is not for FLUX workflows, register it under a different config/model type explicitly"],"exampleFix":"// before\nmymodel/\n  text_encoder_2/...\n// after\nmymodel/\n  text_encoder_2/...\n  tokenizer_2/\n    tokenizer.json\n    tokenizer_config.json","handlingStrategy":"validation","validationCode":"from pathlib import Path\ndef has_tokenizer2(model_dir: Path) -> bool:\n    return (model_dir / \"tokenizer_2\").is_dir() and any((model_dir / \"tokenizer_2\").iterdir())","typeGuard":null,"tryCatchPattern":"try:\n    install_model(path)\nexcept NotAMatchError as e:\n    if \"tokenizer_2\" in str(e):\n        logger.error(\"Download tokenizer_2/ from the FLUX repo before installing\")","preventionTips":["Always download the full FLUX repo including tokenizer_2/","Check for tokenizer_2 before moving/renaming model folders","Don't build encoder-only installs for FLUX workflows"],"tags":["tokenizer","sdnq","missing-files"],"backgroundTag":"missing-model-folder","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}