{"record":{"id":"1f5fcc409149c9d4","repo":"invoke-ai/InvokeAI","slug":"expected-main-diffusers-ideogram4-config-got-typ","errorCode":null,"errorMessage":"Expected Main_Diffusers_Ideogram4_Config, got {type(config).__name__}.","messagePattern":"Expected Main_Diffusers_Ideogram4_Config, got (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/backend/model_manager/load/model_loaders/ideogram4.py","lineNumber":83,"sourceCode":"    ]\n    if meta:\n        raise RuntimeError(\n            f\"{context}: {len(meta)} parameter(s) remain on the meta device after loading \"\n            f\"(missing or mismatched weights): {meta[:10]}\"\n        )\n\n\n@ModelLoaderRegistry.register(base=BaseModelType.Ideogram4, type=ModelType.Main, format=ModelFormat.Diffusers)\nclass Ideogram4DiffusersModel(ModelLoader):\n    \"\"\"Loads Ideogram 4 main models (nf4 / fp8) bundled in diffusers layout.\"\"\"\n\n    def _load_model(\n        self,\n        config: AnyModelConfig,\n        submodel_type: Optional[SubModelType] = None,\n    ) -> AnyModel:\n        if not isinstance(config, Main_Diffusers_Ideogram4_Config):\n            raise ValueError(f\"Expected Main_Diffusers_Ideogram4_Config, got {type(config).__name__}.\")\n        if submodel_type is None:\n            raise Exception(\"A submodel type must be provided when loading Ideogram 4 main pipelines.\")\n\n        model_path = Path(config.path)\n\n        match submodel_type:\n            case SubModelType.Transformer:\n                return self._load_transformer_pair(model_path)\n            case SubModelType.TextEncoder:\n                return self._load_text_encoder(model_path)\n            case SubModelType.Tokenizer:\n                from transformers import AutoTokenizer\n\n                return AutoTokenizer.from_pretrained(model_path / \"tokenizer\", local_files_only=True)\n            case SubModelType.VAE:\n                return self._load_vae(model_path)\n\n        raise ValueError(","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/model_manager/load/model_loaders/ideogram4.py#L65-L101","documentation":"The Ideogram 4 loader only accepts its typed config record Main_Diffusers_Ideogram4_Config. Passing any other config subclass (another model family's or a generic checkpoint config) means the loader's assumptions about config.path and the diffusers layout would be invalid, so it fails fast with a ValueError naming the actual type received.","triggerScenarios":"Calling _load_model (or dispatching a load through the model manager) with a config object that is not an instance of Main_Diffusers_Ideogram4_Config while routing to the Ideogram4 loader.","commonSituations":"Model-registry records pointing at the wrong loader; hand-written loader invocations reusing another model's config object; config serialization/deserialization yielding a base config type instead of the specific one.","solutions":["Ensure the model record is stored as Main_Diffusers_Ideogram4_Config (correct base/type/format fields) so registry dispatch creates the right config class.","Wrap or convert the incoming config to Main_Diffusers_Ideogram4_Config before calling the loader.","Check the loader registration/dispatch logic — BaseModelType.Ideogram4 with ModelType.Main and ModelFormat.Diffusers — is being matched."],"exampleFix":"// before\nloader._load_model(SomeOtherConfig(path=...), SubModelType.Transformer)\n// after\nfrom invokeai.backend.model_manager.configs.main import Main_Diffusers_Ideogram4_Config\ncfg = Main_Diffusers_Ideogram4_Config(path=...)\nloader._load_model(cfg, SubModelType.Transformer)","handlingStrategy":"type-guard","validationCode":"from invokeai.backend.model_manager.configs.main import Main_Diffusers_Ideogram4_Config\nif not isinstance(config, Main_Diffusers_Ideogram4_Config):\n    raise TypeError(f\"need Ideogram4 config, got {type(config).__name__}\")","typeGuard":"def is_ideogram4_config(config) -> bool:\n    from invokeai.backend.model_manager.configs.main import Main_Diffusers_Ideogram4_Config\n    return isinstance(config, Main_Diffusers_Ideogram4_Config)","tryCatchPattern":"try:\n    model = loader._load_model(config, submodel_type)\nexcept ValueError as e:\n    if \"Expected Main_Diffusers_Ideogram4_Config\" in str(e):\n        config = convert_to_ideogram4_config(config)\n        model = loader._load_model(config, submodel_type)\n    else:\n        raise","preventionTips":["Register models with the exact base/type/format that maps to the intended loader.","Use typed config constructors rather than reusing config objects across model families.","Add isinstance assertions in dispatch layers before invoking family-specific loaders."],"tags":["type-mismatch","config","model-loading"],"backgroundTag":"wrong-config-type","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}