{"record":{"id":"d2072a15756d2b30","repo":"invoke-ai/InvokeAI","slug":"unsupported-noise-type-noise-type","errorCode":null,"errorMessage":"Unsupported noise type: {noise_type}","messagePattern":"Unsupported noise type: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/app/invocations/latent_noise.py","lineNumber":43,"sourceCode":"    height: int,\n) -> tuple[int, ...]:\n    validate_noise_dimensions(noise_type, width, height)\n\n    if noise_type == \"SD\":\n        return (1, 4, height // LATENT_SCALE_FACTOR, width // LATENT_SCALE_FACTOR)\n    if noise_type == \"FLUX\":\n        return (1, 16, height // LATENT_SCALE_FACTOR, width // LATENT_SCALE_FACTOR)\n    if noise_type == \"FLUX.2\":\n        return (1, 32, height // LATENT_SCALE_FACTOR, width // LATENT_SCALE_FACTOR)\n    if noise_type == \"SD3\":\n        return (1, 16, height // LATENT_SCALE_FACTOR, width // LATENT_SCALE_FACTOR)\n    if noise_type == \"CogView4\":\n        return (1, 16, height // LATENT_SCALE_FACTOR, width // LATENT_SCALE_FACTOR)\n    if noise_type == \"Z-Image\":\n        return (1, 16, height // LATENT_SCALE_FACTOR, width // LATENT_SCALE_FACTOR)\n    if noise_type == \"Anima\":\n        return (1, 16, 1, height // LATENT_SCALE_FACTOR, width // LATENT_SCALE_FACTOR)\n    raise ValueError(f\"Unsupported noise type: {noise_type}\")\n\n\ndef validate_noise_tensor_shape(noise: torch.Tensor, noise_type: LatentNoiseType, width: int, height: int) -> None:\n    expected_shape = get_expected_noise_shape(noise_type, width, height)\n    if tuple(noise.shape) != expected_shape:\n        raise ValueError(f\"Expected noise with shape {expected_shape}, got {tuple(noise.shape)}\")\n\n\ndef generate_noise_tensor(\n    noise_type: LatentNoiseType,\n    width: int,\n    height: int,\n    seed: int,\n    device: torch.device,\n    dtype: torch.dtype,\n    use_cpu: bool = True,\n) -> torch.Tensor:\n    validate_noise_dimensions(noise_type, width, height)","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/invocations/latent_noise.py#L25-L61","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Use one of the exact supported values: \"SD\", \"FLUX\", \"FLUX.2\", \"SD3\", \"CogView4\", \"Z-Image\", \"Anima\" (check spelling and case).","Update InvokeAI if your noise type was added in a newer release than the one installed.","Validate/normalize the incoming string against the LatentNoiseType set before calling, and reject unknown values early with a clear UI message."],"exampleFix":"// before\nnoise_type = workflow[\"noise_type\"]  # \"Flux\"\n// after\nVALID = {\"SD\", \"FLUX\", \"FLUX.2\", \"SD3\", \"CogView4\", \"Z-Image\", \"Anima\"}\nnoise_type = workflow[\"noise_type\"]\nif noise_type not in VALID:\n    raise ValueError(f\"noise_type must be one of {sorted(VALID)}, got {noise_type!r}\")","handlingStrategy":"validation","validationCode":"VALID_NOISE_TYPES = {\"SD\", \"FLUX\", \"FLUX.2\", \"SD3\", \"CogView4\", \"Z-Image\", \"Anima\"}\nif noise_type not in VALID_NOISE_TYPES:\n    raise ValueError(f\"noise_type must be one of {sorted(VALID_NOISE_TYPES)}, got {noise_type!r}\")","typeGuard":"from typing import get_args\nfrom invokeai.app.invocations.latent_noise import LatentNoiseType\n\ndef is_valid_noise_type(v: str) -> bool:\n    return v in get_args(LatentNoiseType)","tryCatchPattern":"try:\n    shape = get_expected_noise_shape(noise_type, width, height)\nexcept ValueError as e:\n    if \"Unsupported noise type\" in str(e):\n        logger.error(f\"Unknown noise_type {noise_type!r}; supported: SD, FLUX, FLUX.2, SD3, CogView4, Z-Image, Anima\")\n        noise_type = \"SD\"  # or re-raise after fixing input\n    else:\n        raise","preventionTips":["Take noise_type values only from the Literal/enum, never free-form strings.","Normalize case and spelling of externally supplied values before use.","Re-validate saved workflow JSON after upgrading InvokeAI in case the type set changed.","Use typing/Literal checking in scripts (mypy) to catch invalid values statically."],"tags":["validation","unsupported-value","noise","configuration"],"backgroundTag":"unsupported-enum-value","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}