{"record":{"id":"c79215eb3b837305","repo":"invoke-ai/InvokeAI","slug":"self-class-has-the-config-param-addition-em-c79215","errorCode":null,"errorMessage":"{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`","messagePattern":"(.+?) 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`","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/backend/util/hotfixes.py","lineNumber":693,"sourceCode":"            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\n\n        # 2. pre-process\n        sample = self.conv_in(sample)\n\n        controlnet_cond = self.controlnet_cond_embedding(controlnet_cond)\n        sample = sample + controlnet_cond","sourceCodeStart":675,"sourceCodeEnd":711,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/util/hotfixes.py#L675-L711","documentation":"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'.","triggerScenarios":"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.","commonSituations":"Custom SDXL inference loops that set text_embeds only; refactors that renamed the key; pipelines ported from non-SDXL code.","solutions":["Include time_ids in added_cond_kwargs, e.g. torch.tensor([[orig_h, orig_w, crop_top, crop_left, target_h, target_w]])","Use StableDiffusionXLPipeline to construct time_ids automatically","Validate the added_cond_kwargs dict keys before calling forward"],"exampleFix":"// before\nadded_cond_kwargs = {\"text_embeds\": pooled_embeds}\n// after\nadded_cond_kwargs = {\"text_embeds\": pooled_embeds, \"time_ids\": torch.tensor([[1024, 1024, 0, 0, 1024, 1024]])}","handlingStrategy":"validation","validationCode":"if getattr(unet.config, 'addition_embed_type', None) == 'text_time':\n    added_cond_kwargs = added_cond_kwargs or {}\n    added_cond_kwargs.setdefault('time_ids', torch.tensor([[orig_h, orig_w, crop_top, crop_left, target_h, target_w]], device=unet.device))","typeGuard":"def has_time_ids(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 'time_ids' 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 time_ids: %s\", e)\n    raise","preventionTips":["Define a helper that builds the full text_time dict (text_embeds + time_ids) once and reuse it","Validate dict keys with an assertion before each forward call","Match time_ids batch size to the latent batch size"],"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"}