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 `time_ids` to be passed in `added_cond_kwargs`

What it means

Same 'text_time' additive-embedding path as text_embeds, but this guard fires when added_cond_kwargs lacks 'time_ids', the original image size/crop/top-left coordinates used by SDXL micro-conditioning. Both keys are mandatory for addition_embed_type='text_time'.

Source

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

            if self.config.class_embed_type == "timestep":
                class_labels = self.time_proj(class_labels)

            class_emb = self.class_embedding(class_labels).to(dtype=self.dtype)
            emb = emb + class_emb

        if "addition_embed_type" in self.config:
            if self.config.addition_embed_type == "text":
                aug_emb = self.add_embedding(encoder_hidden_states)

            elif self.config.addition_embed_type == "text_time":
                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)

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

        # 2. pre-process
        sample = self.conv_in(sample)

        controlnet_cond = self.controlnet_cond_embedding(controlnet_cond)
        sample = sample + controlnet_cond

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Include time_ids in added_cond_kwargs, e.g. torch.tensor([[orig_h, orig_w, crop_top, crop_left, target_h, target_w]])
  2. Use StableDiffusionXLPipeline to construct time_ids automatically
  3. Validate the added_cond_kwargs dict keys before calling forward

Example fix

// before
added_cond_kwargs = {"text_embeds": pooled_embeds}
// after
added_cond_kwargs = {"text_embeds": pooled_embeds, "time_ids": torch.tensor([[1024, 1024, 0, 0, 1024, 1024]])}
Defensive patterns

Strategy: validation

Validate before calling

if getattr(unet.config, 'addition_embed_type', None) == 'text_time':
    added_cond_kwargs = added_cond_kwargs or {}
    added_cond_kwargs.setdefault('time_ids', torch.tensor([[orig_h, orig_w, crop_top, crop_left, target_h, target_w]], device=unet.device))

Type guard

def has_time_ids(unet, added_cond_kwargs):
    if getattr(unet.config, 'addition_embed_type', None) != 'text_time':
        return True
    return isinstance(added_cond_kwargs, dict) and 'time_ids' in added_cond_kwargs

Try / catch

try:
    out = unet(x, t, emb, added_cond_kwargs=added_cond_kwargs)
except ValueError as e:
    logger.error("missing time_ids: %s", e)
    raise

Prevention

When it happens

Trigger: Calling forward() on an SDXL UNet with added_cond_kwargs containing text_embeds but no 'time_ids' key; hand-building conditioning dicts and dropping time_ids.

Common situations: Custom SDXL inference loops that set text_embeds only; refactors that renamed the key; pipelines ported from non-SDXL code.

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