invoke-ai/InvokeAI · error · ValueError

Unsupported noise type: {noise_type}

Error message

Unsupported noise type: {noise_type}

What it means

get_expected_noise_shape maps a LatentNoiseType to the expected noise tensor shape and raises ValueError('Unsupported noise type: ...') when the noise_type matches none of the known SD/FLUX/FLUX.2/SD3/CogView4/Z-Image/Anima branches. The Literal type should prevent this statically, but values can arrive at runtime from config files, API payloads, or older/newer versions where the type set differs.

Source

Thrown at invokeai/app/invocations/latent_noise.py:43

    height: int,
) -> tuple[int, ...]:
    validate_noise_dimensions(noise_type, width, height)

    if noise_type == "SD":
        return (1, 4, height // LATENT_SCALE_FACTOR, width // LATENT_SCALE_FACTOR)
    if noise_type == "FLUX":
        return (1, 16, height // LATENT_SCALE_FACTOR, width // LATENT_SCALE_FACTOR)
    if noise_type == "FLUX.2":
        return (1, 32, height // LATENT_SCALE_FACTOR, width // LATENT_SCALE_FACTOR)
    if noise_type == "SD3":
        return (1, 16, height // LATENT_SCALE_FACTOR, width // LATENT_SCALE_FACTOR)
    if noise_type == "CogView4":
        return (1, 16, height // LATENT_SCALE_FACTOR, width // LATENT_SCALE_FACTOR)
    if noise_type == "Z-Image":
        return (1, 16, height // LATENT_SCALE_FACTOR, width // LATENT_SCALE_FACTOR)
    if noise_type == "Anima":
        return (1, 16, 1, height // LATENT_SCALE_FACTOR, width // LATENT_SCALE_FACTOR)
    raise ValueError(f"Unsupported noise type: {noise_type}")


def validate_noise_tensor_shape(noise: torch.Tensor, noise_type: LatentNoiseType, width: int, height: int) -> None:
    expected_shape = get_expected_noise_shape(noise_type, width, height)
    if tuple(noise.shape) != expected_shape:
        raise ValueError(f"Expected noise with shape {expected_shape}, got {tuple(noise.shape)}")


def generate_noise_tensor(
    noise_type: LatentNoiseType,
    width: int,
    height: int,
    seed: int,
    device: torch.device,
    dtype: torch.dtype,
    use_cpu: bool = True,
) -> torch.Tensor:
    validate_noise_dimensions(noise_type, width, height)

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Use one of the exact supported values: "SD", "FLUX", "FLUX.2", "SD3", "CogView4", "Z-Image", "Anima" (check spelling and case).
  2. Update InvokeAI if your noise type was added in a newer release than the one installed.
  3. Validate/normalize the incoming string against the LatentNoiseType set before calling, and reject unknown values early with a clear UI message.

Example fix

// before
noise_type = workflow["noise_type"]  # "Flux"
// after
VALID = {"SD", "FLUX", "FLUX.2", "SD3", "CogView4", "Z-Image", "Anima"}
noise_type = workflow["noise_type"]
if noise_type not in VALID:
    raise ValueError(f"noise_type must be one of {sorted(VALID)}, got {noise_type!r}")
Defensive patterns

Strategy: validation

Validate before calling

VALID_NOISE_TYPES = {"SD", "FLUX", "FLUX.2", "SD3", "CogView4", "Z-Image", "Anima"}
if noise_type not in VALID_NOISE_TYPES:
    raise ValueError(f"noise_type must be one of {sorted(VALID_NOISE_TYPES)}, got {noise_type!r}")

Type guard

from typing import get_args
from invokeai.app.invocations.latent_noise import LatentNoiseType

def is_valid_noise_type(v: str) -> bool:
    return v in get_args(LatentNoiseType)

Try / catch

try:
    shape = get_expected_noise_shape(noise_type, width, height)
except ValueError as e:
    if "Unsupported noise type" in str(e):
        logger.error(f"Unknown noise_type {noise_type!r}; supported: SD, FLUX, FLUX.2, SD3, CogView4, Z-Image, Anima")
        noise_type = "SD"  # or re-raise after fixing input
    else:
        raise

Prevention

When it happens

Trigger: Passing a string that is not in the Literal set — e.g. "Flux" (wrong case), "SDXL", "Krea-2", an empty string, or a value deserialized from a saved workflow JSON created in a different InvokeAI version — into get_expected_noise_shape (usually via validate_noise_tensor_shape).

Common situations: Custom scripts or plugins construct the noise type string manually; workflows saved in one version carry a noise-type value removed/renamed in another; case-mismatched user input bypasses the type checker when values come from dynamic sources.

Related errors


AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29). Data as JSON: /api/errors/d2072a15756d2b30. Report an issue: GitHub.