{"record":{"id":"25c1ea235f1e46a9","repo":"invoke-ai/InvokeAI","slug":"unsupported-base-model-base-model","errorCode":null,"errorMessage":"Unsupported base model: {base_model}","messagePattern":"Unsupported base model: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/app/util/step_callback.py","lineNumber":370,"sourceCode":"    elif base_model == BaseModelType.ErnieImage:\n        # ERNIE-Image uses AutoencoderKLFlux2 (same as FLUX.2) with 32 latent channels, and the\n        # denoise loop unpatches before previewing, so the shapes line up. The values do not:\n        # ERNIE denoises in BN-normalized latent space (denormalized only at VAE decode) and the\n        # BN stats live on the VAE, which isn't loaded here. Previews are therefore approximate\n        # in color/contrast.\n        latent_rgb_factors = FLUX2_LATENT_RGB_FACTORS\n        latent_rgb_bias = FLUX2_LATENT_RGB_BIAS\n    elif base_model == BaseModelType.Wan:\n        # A14B (16-ch standard Wan VAE, 8x spatial) vs TI2V-5B (48-ch Wan2.2-VAE,\n        # 16x spatial). The latent channel count uniquely identifies the variant.\n        if sample.shape[-3] == 48:\n            latent_rgb_factors = WAN22_LATENT_RGB_FACTORS\n            latent_rgb_bias = WAN22_LATENT_RGB_BIAS\n        else:\n            latent_rgb_factors = WAN_LATENT_RGB_FACTORS\n            latent_rgb_bias = WAN_LATENT_RGB_BIAS\n    else:\n        raise ValueError(f\"Unsupported base model: {base_model}\")\n\n    latent_rgb_factors_torch = torch.tensor(latent_rgb_factors, dtype=sample.dtype, device=sample.device)\n    smooth_matrix_torch = (\n        torch.tensor(smooth_matrix, dtype=sample.dtype, device=sample.device) if smooth_matrix else None\n    )\n    latent_rgb_bias_torch = (\n        torch.tensor(latent_rgb_bias, dtype=sample.dtype, device=sample.device) if latent_rgb_bias else None\n    )\n    image = sample_to_lowres_estimated_image(\n        samples=sample,\n        latent_rgb_factors=latent_rgb_factors_torch,\n        smooth_matrix=smooth_matrix_torch,\n        latent_rgb_bias=latent_rgb_bias_torch,\n    )\n\n    # Spatial downscale ratio: 8x is the SD/SDXL/FLUX/Wan-A14B default;\n    # Wan TI2V-5B's Wan2.2-VAE uses 16x.\n    spatial_scale = 8","sourceCodeStart":352,"sourceCodeEnd":388,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/util/step_callback.py#L352-L388","documentation":"diffusion_step_callback decodes intermediate latents to RGB previews using per-base-model latent-to-RGB factor/bias matrices. If the run's base_model has no known latent RGB factors table, it raises ValueError listing the unsupported base model.","triggerScenarios":"A diffusion step callback fires (preview image generation) while base_model is a value not covered by the factor tables in step_callback.py (e.g. a newly added model family like Flux2 or a custom/unknown enum value).","commonSituations":"New model type supported elsewhere in InvokeAI but not yet in the preview-latent decoder; older/patched builds where the step_callback module lags behind supported models; corrupted enum value in the denoise parameters.","solutions":["Upgrade InvokeAI to a version whose step_callback supports your model's base type","Disable intermediate previews for that model so the callback's latent decoding path is not hit","Check invokeai/app/util/step_callback.py and add the latent RGB factors for the new base model if contributing a patch","Verify the graph/denoise params reference the correct model with a supported base"],"exampleFix":"// before (adding a new base)\n# no factors defined -> ValueError: Unsupported base model: BaseModelType.NewModel\n// after\nNEW_LATENT_RGB_FACTORS = [[...], ...]\nNEW_LATENT_RGB_BIAS = [...]\n# add an elif branch mapping BaseModelType.NewModel to these tables","handlingStrategy":"try-catch","validationCode":"from invokeai.backend.model_manager.config import BaseModelType\nSUPPORTED_PREVIEWS = {b for b in BaseModelType}  # verify against step_callback.py tables\n\ndef previews_supported(base_model):\n    return base_model in SUPPORTED_PREVIEWS","typeGuard":null,"tryCatchPattern":"try:\n    result_images = sampling_result_latents_images(...)\nexcept ValueError as e:\n    if 'Unsupported base model' in str(e):\n        disable_intermediate_previews()\n        result_images = sampling_result_latents_images(..., with_preview=False)\n    else:\n        raise","preventionTips":["Keep InvokeAI up to date when using newly added model families","Disable step previews for experimental models","Check that installed model base type matches a supported entry in step_callback.py"],"tags":["python","valueerror","unsupported-model","preview"],"backgroundTag":"unsupported-base-model","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}