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' which requires the keyword argument `image_embeds` to be passed in `added_cond_kwargs` What it means
The UNet config sets `addition_embed_type='image'` (Kandinsky 2.2 style), so forward requires `added_cond_kwargs['image_embeds']` to compute the augmentation embedding from image embeddings alone. It raises when the key is missing from `added_cond_kwargs`.
Source
Thrown at invokeai/backend/hidiffusion/hidiffusion.py:1105
if "text_embeds" not in added_cond_kwargs:
raise ValueError(
f"{self.__class__} has the config param `addition_embed_type` set to 'text_time' which requires the keyword argument `text_embeds` to be passed in `added_cond_kwargs`"
)
text_embeds = added_cond_kwargs.get("text_embeds")
if "time_ids" not in added_cond_kwargs:
raise ValueError(
f"{self.__class__} has the config param `addition_embed_type` set to 'text_time' which requires the keyword argument `time_ids` to be passed in `added_cond_kwargs`"
)
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:View on GitHub (pinned to 0b6a024f2f)
Solutions
- Pass `added_cond_kwargs={'image_embeds': image_embeds}` (from Kandinsky's image encoder / CLIP vision model) to forward
- Confirm the checkpoint type: Kandinsky 2.2 uses only image embeds; 2.1 needs text+image
- Reload a non-image-conditioned UNet if image conditioning is not intended
Example fix
// before
noise_pred = unet(sample, t, encoder_hidden_states=text_emb)
// after
noise_pred = unet(sample, t, encoder_hidden_states=text_emb,
added_cond_kwargs={'image_embeds': image_embeds}) Defensive patterns
Strategy: validation
Validate before calling
if getattr(unet.config, 'addition_embed_type', None) == 'image' and not (added_cond_kwargs and 'image_embeds' in added_cond_kwargs):
raise ValueError("image-embedding UNet requires added_cond_kwargs={'image_embeds': ...}") Type guard
def has_image_embeds(added_cond_kwargs) -> bool:
return isinstance(added_cond_kwargs, dict) and 'image_embeds' in added_cond_kwargs Try / catch
try:
out = unet(sample, t, emb, added_cond_kwargs=ackw)
except ValueError as e:
if 'image_embeds' in str(e):
ackw = {'image_embeds': image_embeds}; out = unet(sample, t, emb, added_cond_kwargs=ackw)
else: raise Prevention
- Check `addition_embed_type` before calling forward on third-party checkpoints
- Compute image embeds from the checkpoint's own image encoder
- Do not reuse SD-loop code for Kandinsky 2.2 UNets
When it happens
Trigger: Calling forward on a UNet with `config.addition_embed_type == 'image'` (Kandinsky 2.2) without `added_cond_kwargs={'image_embeds': ...}`.
Common situations: Loading a Kandinsky 2.2 UNet and calling it with a generic SD-style signature; migrating pipelines between Kandinsky 2.1 (text_image) and 2.2 (image) where the required kwargs differ; omitting `added_cond_kwargs` entirely in custom loops.
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
- {self.__class__} has the config param `addition_embed_type`
- {self.__class__} has the config param `encoder_hid_dim_type`
- class_labels should be provided when num_class_embeds > 0
- {self.__class__} has the config param `addition_embed_type`
- {self.__class__} has the config param `addition_embed_type`
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/8578ad059cc8f312.
Report an issue: GitHub.