invoke-ai/InvokeAI · error · ValueError

addition_embed_type: {addition_embed_type} must be None, 'te

Error message

addition_embed_type: {addition_embed_type} must be None, 'text' or 'text_image'.

What it means

The constructor supports only a fixed set of `addition_embed_type` values (None, 'text', 'text_image', plus the 'text_time' branch shown just above the raise). Any other value reaches this final elif and raises a ValueError listing the acceptable options. This guard ensures unsupported extra-embedding backends (used for SDXL-style additive timestep/text conditioning) are rejected at init rather than failing silently later.

Source

Thrown at invokeai/backend/util/hotfixes.py:275

            self.add_embedding = TextTimeEmbedding(
                text_time_embedding_from_dim, time_embed_dim, num_heads=addition_embed_type_num_heads
            )
        elif addition_embed_type == "text_image":
            # text_embed_dim and image_embed_dim DON'T have to be `cross_attention_dim`.
            # To not clutter the __init__ too much
            # they are set to `cross_attention_dim` here as this is exactly the required dimension...
            # for the currently only use
            # case when `addition_embed_type == "text_image"` (Kadinsky 2.1)`
            self.add_embedding = TextImageTimeEmbedding(
                text_embed_dim=cross_attention_dim, image_embed_dim=cross_attention_dim, time_embed_dim=time_embed_dim
            )
        elif addition_embed_type == "text_time":
            self.add_time_proj = Timesteps(addition_time_embed_dim, flip_sin_to_cos, freq_shift)
            self.add_embedding = TimestepEmbedding(projection_class_embeddings_input_dim, time_embed_dim)

        elif addition_embed_type is not None:
            raise ValueError(f"addition_embed_type: {addition_embed_type} must be None, 'text' or 'text_image'.")

        # control net conditioning embedding
        self.controlnet_cond_embedding = ControlNetConditioningEmbedding(
            conditioning_embedding_channels=block_out_channels[0],
            block_out_channels=conditioning_embedding_out_channels,
            conditioning_channels=conditioning_channels,
        )

        self.down_blocks = nn.ModuleList([])
        self.controlnet_down_blocks = nn.ModuleList([])

        if isinstance(only_cross_attention, bool):
            only_cross_attention = [only_cross_attention] * len(down_block_types)

        if isinstance(attention_head_dim, int):
            attention_head_dim = (attention_head_dim,) * len(down_block_types)

        if isinstance(num_attention_heads, int):

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Use only supported values: omit `addition_embed_type`, or set it to 'text', 'text_image', or 'text_time' (with the required companion args like addition_time_embed_dim and projection_class_embeddings_input_dim).
  2. For SDXL text-time conditioning, set `addition_embed_type='text_time'`, `addition_time_embed_dim=256`, and `projection_class_embeddings_input_dim` to the model's total conditioning dim.
  3. If the checkpoint genuinely requires an unsupported type, upgrade InvokeAI/diffusers or instantiate the stock diffusers model class instead.
  4. Validate the string (case/whitespace/underscore vs hyphen) before passing it in.

Example fix

// before
model = ControlNetModel2_5(
    addition_embed_type="image",
)
// after
model = ControlNetModel2_5(
    addition_embed_type="text_time",
    addition_time_embed_dim=256,
    projection_class_embeddings_input_dim=2816,
)
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED = {None, "text", "text_image", "text_time"}
a = model_config.get("addition_embed_type")
if a not in SUPPORTED:
    raise ValueError(f"addition_embed_type={a!r} not supported; choose from {SUPPORTED}")

Type guard

from typing import Optional
def is_valid_addition_embed_type(v: Optional[str]) -> bool:
    return v in (None, "text", "text_image", "text_time")

Try / catch

try:
    model = ControlNetModel2_5(**cfg)
except ValueError as e:
    if "addition_embed_type" in str(e):
        cfg["addition_embed_type"] = "text_time"  # SDXL-style conditioning
        cfg.setdefault("addition_time_embed_dim", 256)
        model = ControlNetModel2_5(**cfg)
    else:
        raise

Prevention

When it happens

Trigger: Passing `addition_embed_type` values like 'text_time', 'image', 'ip_adapter', or misspellings when the vendored class's supported set is only None/'text'/'text_image'/'text_time'; or a newer diffusers checkpoint config using 'text_time'/'image_hint' variants that this hotfix copy does not enumerate.

Common situations: Loading SDXL/SDXL-Turbo-derived checkpoints into the hotfixed ControlNet class; typos when hand-editing configs; version skew where the checkpoint config has an addition_embed_type added in a later diffusers release than the vendored code supports.

Related errors


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