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 'text_time' which requires the keyword argument `text_embeds` to be passed in `added_cond_kwargs`

What it means

The UNet config sets `addition_embed_type='text_time'` (SDXL-style extra conditioning), so forward requires `added_cond_kwargs['text_embeds']` (pooled text embeddings) to build the augmentation embedding. The model raises when this key is missing rather than continuing with incomplete SDXL conditioning.

Source

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

                else:
                    emb = emb + class_emb

            if self.config.addition_embed_type == "text":
                aug_emb = self.add_embedding(encoder_hidden_states)
            elif self.config.addition_embed_type == "text_image":
                # Kandinsky 2.1 - style
                if "image_embeds" not in added_cond_kwargs:
                    raise ValueError(
                        f"{self.__class__} has the config param `addition_embed_type` set to 'text_image' which requires the keyword argument `image_embeds` to be passed in `added_cond_kwargs`"
                    )

                image_embs = added_cond_kwargs.get("image_embeds")
                text_embs = added_cond_kwargs.get("text_embeds", encoder_hidden_states)
                aug_emb = self.add_embedding(text_embs, image_embs)
            elif self.config.addition_embed_type == "text_time":
                # SDXL - style
                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`"

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Pass `added_cond_kwargs={'text_embeds': pooled_prompt_embeds, 'time_ids': add_time_ids}` to the UNet call
  2. Compute pooled embeddings via the SDXL text encoder's `text_encoder_2(...).pooler_output` and build `add_time_ids` from original/resolution/target sizes
  3. If SDXL conditioning is undesired, reload the UNet with a non-`text_time` `addition_embed_type`

Example fix

// before
noise_pred = unet(sample, t, encoder_hidden_states=prompt_emb)
// after
noise_pred = unet(sample, t, encoder_hidden_states=prompt_emb,
                  added_cond_kwargs={'text_embeds': pooled_prompt_embeds,
                                     'time_ids': add_time_ids})
Defensive patterns

Strategy: validation

Validate before calling

if getattr(unet.config, 'addition_embed_type', None) == 'text_time' and not (added_cond_kwargs and 'text_embeds' in added_cond_kwargs):
    raise ValueError("SDXL UNet requires added_cond_kwargs with 'text_embeds' (and 'time_ids')")

Type guard

def has_text_embeds(added_cond_kwargs) -> bool:
    return isinstance(added_cond_kwargs, dict) and 'text_embeds' in added_cond_kwargs

Try / catch

try:
    out = unet(sample, t, emb, added_cond_kwargs=ackw)
except ValueError as e:
    if 'text_embeds' in str(e):
        ackw['text_embeds'] = pooled_prompt_embeds; out = unet(sample, t, emb, added_cond_kwargs=ackw)
    else: raise

Prevention

When it happens

Trigger: Calling forward on an SDXL UNet (`addition_embed_type='text_time'`) without `added_cond_kwargs={'text_embeds': ..., 'time_ids': ...}`, or with only `time_ids` supplied.

Common situations: Porting an SD 1.5 sampling loop to SDXL without adding the extra conditioning; calling `unet.forward` directly in a custom scheduler loop; using a refiner/base SDXL pipeline that drops `added_cond_kwargs` during denormalized timesteps.

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/f5d0431896562f52. Report an issue: GitHub.