{"record":{"id":"4ea5f66b4a1f9991","repo":"invoke-ai/InvokeAI","slug":"no-text-encoder-2-config-json-or-config-json-at-mo","errorCode":null,"errorMessage":"no text_encoder_2/config.json or config.json at model root","messagePattern":"no text_encoder_2/config\\.json or config\\.json at model root","errorType":"validation","errorClass":"NotAMatchError","httpStatus":null,"severity":"info","filePath":"invokeai/backend/model_manager/configs/t5_encoder.py","lineNumber":175,"sourceCode":"        \"\"\"Return the ``tokenizer_2/`` directory for either layout, or None if it doesn't exist.\n\n        In the standalone-bundle layout ``tokenizer_2/`` is a child of the pipeline root; in the\n        inline layout (``path`` is the ``text_encoder_2`` folder) it's a *sibling* of that folder.\n        The encoder loader picks the encoder dir by the same layout test, so the tokenizer must too —\n        using ``path / \"tokenizer_2\"`` unconditionally is wrong for the inline case.\n        \"\"\"\n        if (path / \"text_encoder_2\" / \"config.json\").exists():\n            candidate = path / \"tokenizer_2\"\n        else:\n            candidate = path.parent / \"tokenizer_2\"\n        return candidate if candidate.exists() else None\n\n    @classmethod\n    def _locate_text_encoder_dir(cls, mod: ModelOnDisk):\n        \"\"\"Return the directory that actually holds T5's config.json + safetensors.\"\"\"\n        te_dir = cls.resolve_text_encoder_dir(mod.path)\n        if te_dir is None:\n            raise NotAMatchError(\"no text_encoder_2/config.json or config.json at model root\")\n        return te_dir\n\n    @classmethod\n    def _raise_if_not_sdnq_quantized(cls, te_dir) -> None:\n        quant_config_path = te_dir / \"quantization_config.json\"\n        if quant_config_path.exists():\n            try:\n                with open(quant_config_path, \"r\", encoding=\"utf-8\") as f:\n                    quant_config = json.load(f)\n            except (OSError, ValueError):\n                quant_config = {}\n            if quant_config.get(\"quant_method\") == \"sdnq\":\n                return\n\n        if _safetensors_dir_has_sdnq_keys(te_dir):\n            return\n\n        raise NotAMatchError(\"text_encoder_2 does not look like an SDNQ-quantized T5 encoder\")","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/configs/t5_encoder.py#L157-L193","documentation":"NotAMatchError from _locate_text_encoder_dir (called by T5Encoder_SDNQ_Config.from_model_on_disk). The helper resolve_text_encoder_dir looks for `text_encoder_2/config.json` or a root `config.json`; if neither exists the code cannot locate the T5 encoder directory and declines the match.","triggerScenarios":"from_model_on_disk on a model dir with no `text_encoder_2/config.json` and no `config.json` at the root — weights present but config missing, or everything nested one level too deep.","commonSituations":"Partial downloads that skip config.json, archives that extract into an extra wrapper directory, or manually assembled folders missing diffusers config files.","solutions":["Add `text_encoder_2/config.json` (or a root `config.json`) from the source repo","Flatten the folder so the expected layout applies (remove the extra wrapper directory)","Re-download the model ensuring config.json is included"],"exampleFix":"// before\ndownloads/model-wrapper/mymodel/text_encoder_2/config.json  (model root = downloads/model-wrapper)\n// after\nmymodel/text_encoder_2/config.json  (model root = mymodel)","handlingStrategy":"validation","validationCode":"from pathlib import Path\ndef has_encoder_config(model_dir: Path) -> bool:\n    return (model_dir / \"config.json\").exists() or (model_dir / \"text_encoder_2\" / \"config.json\").exists()","typeGuard":null,"tryCatchPattern":"try:\n    install_model(path)\nexcept NotAMatchError as e:\n    if \"config.json\" in str(e):\n        logger.error(\"Missing T5 config.json; re-download or flatten the folder layout\")","preventionTips":["Verify config.json exists after extracting archives","Remove extra wrapper directories from downloaded zips","Keep diffusers layout intact (config.json alongside weights)"],"tags":["config-missing","diffusers-layout","not-a-match"],"backgroundTag":"missing-model-folder","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}