invoke-ai/InvokeAI · error · ValueError

{self.__class__} has the config param `addition_embed_type`

Error message

{self.__class__} has the config param `addition_embed_type` set to 'image_hint' which requires the keyword arguments `image_embeds` and `hint` to be passed in `added_cond_kwargs`

What it means

For `addition_embed_type='image_hint'` (Kandinsky 2.2 ControlNet-style), forward requires both `added_cond_kwargs['image_embeds']` and `added_cond_kwargs['hint']`; the hint is concatenated to the sample channels and the embedding module returns both `aug_emb` and the processed hint. Either key missing triggers this error.

Source

Thrown at invokeai/backend/hidiffusion/hidiffusion.py:1113

                    )
                time_ids = added_cond_kwargs.get("time_ids")
                time_embeds = self.add_time_proj(time_ids.flatten())
                time_embeds = time_embeds.reshape((text_embeds.shape[0], -1))
                add_embeds = torch.concat([text_embeds, time_embeds], dim=-1)
                add_embeds = add_embeds.to(emb.dtype)
                aug_emb = self.add_embedding(add_embeds)
            elif self.config.addition_embed_type == "image":
                # Kandinsky 2.2 - style
                if "image_embeds" not in added_cond_kwargs:
                    raise ValueError(
                        f"{self.__class__} has the config param `addition_embed_type` set to 'image' which requires the keyword argument `image_embeds` to be passed in `added_cond_kwargs`"
                    )
                image_embs = added_cond_kwargs.get("image_embeds")
                aug_emb = self.add_embedding(image_embs)
            elif self.config.addition_embed_type == "image_hint":
                # Kandinsky 2.2 - style
                if "image_embeds" not in added_cond_kwargs or "hint" not in added_cond_kwargs:
                    raise ValueError(
                        f"{self.__class__} has the config param `addition_embed_type` set to 'image_hint' which requires the keyword arguments `image_embeds` and `hint` to be passed in `added_cond_kwargs`"
                    )
                image_embs = added_cond_kwargs.get("image_embeds")
                hint = added_cond_kwargs.get("hint")
                aug_emb, hint = self.add_embedding(image_embs, hint)
                sample = torch.cat([sample, hint], dim=1)

            emb = emb + aug_emb if aug_emb is not None else emb

            if self.time_embed_act is not None:
                emb = self.time_embed_act(emb)

            if self.encoder_hid_proj is not None and self.config.encoder_hid_dim_type == "text_proj":
                encoder_hidden_states = self.encoder_hid_proj(encoder_hidden_states)
            elif self.encoder_hid_proj is not None and self.config.encoder_hid_dim_type == "text_image_proj":
                # Kadinsky 2.1 - style
                if "image_embeds" not in added_cond_kwargs:
                    raise ValueError(

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Pass both keys: `added_cond_kwargs={'image_embeds': image_embeds, 'hint': hint}`
  2. Provide the hint as a tensor with the channel count the embedding expects (check `add_embedding` / config `in_channels` concatenation)
  3. If no hint conditioning is needed, load the non-hint Kandinsky 2.2 UNet (`addition_embed_type='image'`)

Example fix

// before
unet(sample, t, emb, added_cond_kwargs={'image_embeds': image_embeds})
// after
unet(sample, t, emb, added_cond_kwargs={'image_embeds': image_embeds, 'hint': hint})
Defensive patterns

Strategy: validation

Validate before calling

if getattr(unet.config, 'addition_embed_type', None) == 'image_hint' and not (added_cond_kwargs and 'image_embeds' in added_cond_kwargs and 'hint' in added_cond_kwargs):
    raise ValueError("image_hint UNet requires added_cond_kwargs with both 'image_embeds' and 'hint'")

Type guard

def has_hint_pair(added_cond_kwargs) -> bool:
    return isinstance(added_cond_kwargs, dict) and {'image_embeds', 'hint'} <= added_cond_kwargs.keys()

Try / catch

try:
    out = unet(sample, t, emb, added_cond_kwargs=ackw)
except ValueError as e:
    if 'image_hint' in str(e):
        ackw = {'image_embeds': image_embeds, 'hint': hint}; out = unet(sample, t, emb, added_cond_kwargs=ackw)
    else: raise

Prevention

When it happens

Trigger: Calling forward on a UNet with `config.addition_embed_type == 'image_hint'` where `added_cond_kwargs` lacks `image_embeds` or `hint` (or is absent).

Common situations: Using a Kandinsky 2.2 hint/control checkpoint with a plain sampling loop that passes only image embeds or no extra kwargs; forgetting the control/hint image tensor; confusing 'image' and 'image_hint' embed types when swapping checkpoints.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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