{"record":{"id":"fba87c3eeb6ffcde","repo":"invoke-ai/InvokeAI","slug":"self-class-has-the-config-param-addition-em-fba87c","errorCode":null,"errorMessage":"{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`","messagePattern":"(.+?) 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`","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/backend/util/hotfixes.py","lineNumber":687,"sourceCode":"        aug_emb = None\n\n        if self.class_embedding is not None:\n            if class_labels is None:\n                raise ValueError(\"class_labels should be provided when num_class_embeds > 0\")\n\n            if self.config.class_embed_type == \"timestep\":\n                class_labels = self.time_proj(class_labels)\n\n            class_emb = self.class_embedding(class_labels).to(dtype=self.dtype)\n            emb = emb + class_emb\n\n        if \"addition_embed_type\" in self.config:\n            if self.config.addition_embed_type == \"text\":\n                aug_emb = self.add_embedding(encoder_hidden_states)\n\n            elif self.config.addition_embed_type == \"text_time\":\n                if \"text_embeds\" not in added_cond_kwargs:\n                    raise ValueError(\n                        f\"{self.__class__} has the config param `addition_embed_type` set to 'text_time' which \\\n                            requires the keyword argument `text_embeds` to be passed in `added_cond_kwargs`\"\n                    )\n                text_embeds = added_cond_kwargs.get(\"text_embeds\")\n                if \"time_ids\" not in added_cond_kwargs:\n                    raise ValueError(\n                        f\"{self.__class__} has the config param `addition_embed_type` set to 'text_time' which \\\n                            requires the keyword argument `time_ids` to be passed in `added_cond_kwargs`\"\n                    )\n                time_ids = added_cond_kwargs.get(\"time_ids\")\n                time_embeds = self.add_time_proj(time_ids.flatten())\n                time_embeds = time_embeds.reshape((text_embeds.shape[0], -1))\n\n                add_embeds = torch.concat([text_embeds, time_embeds], dim=-1)\n                add_embeds = add_embeds.to(emb.dtype)\n                aug_emb = self.add_embedding(add_embeds)\n\n        emb = emb + aug_emb if aug_emb is not None else emb","sourceCodeStart":669,"sourceCodeEnd":705,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/util/hotfixes.py#L669-L705","documentation":"For models with addition_embed_type 'text_time' (SDXL-style UNets), forward() needs micro-conditioning text embeds supplied via added_cond_kwargs['text_embeds']. Missing it means the additive embedding branch cannot be computed, so this patched forward raises immediately.","triggerScenarios":"Calling forward() on an SDXL UNet (addition_embed_type='text_time') without added_cond_kwargs, or with added_cond_kwargs lacking the 'text_embeds' key; running a base-UNet call path that only passes time_ids.","commonSituations":"Custom SDXL sampling/LoRA code that forgot text_embeds; reusing SD 1.5-style forward calls against an SDXL checkpoint; pipelines that strip added_cond_kwargs.","solutions":["Pass added_cond_kwargs={\"text_embeds\": pooled_prompt_embeds, \"time_ids\": ...} computed from the text encoder's pooled output","Use the standard SDXL pipeline (StableDiffusionXLPipeline) which populates added_cond_kwargs for you","Check that the checkpoint/config actually matches the call signature you are using"],"exampleFix":"// before\nunet(latents, t, encoder_hidden_states)\n// after\nunet(latents, t, encoder_hidden_states, added_cond_kwargs={\"text_embeds\": pooled_embeds, \"time_ids\": time_ids})","handlingStrategy":"validation","validationCode":"if getattr(unet.config, 'addition_embed_type', None) == 'text_time':\n    added_cond_kwargs = added_cond_kwargs or {}\n    assert 'text_embeds' in added_cond_kwargs, \"SDXL UNet needs text_embeds\"","typeGuard":"def has_text_embeds(unet, added_cond_kwargs):\n    if getattr(unet.config, 'addition_embed_type', None) != 'text_time':\n        return True\n    return isinstance(added_cond_kwargs, dict) and 'text_embeds' in added_cond_kwargs","tryCatchPattern":"try:\n    out = unet(x, t, emb, added_cond_kwargs=added_cond_kwargs)\nexcept ValueError as e:\n    logger.error(\"missing added_cond_kwargs: %s\", e)\n    raise","preventionTips":["Always build added_cond_kwargs from the pooled text encoder output for SDXL","Keep text_embeds and time_ids constructed together","Use StableDiffusionXLPipeline instead of manual forward where possible"],"tags":["valueerror","sdxl","missing-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}