{"record":{"id":"717bad6afe313ff4","repo":"invoke-ai/InvokeAI","slug":"self-class-has-the-config-param-addition-em-717bad","errorCode":null,"errorMessage":"{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`","messagePattern":"(.+?) 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`","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/backend/hidiffusion/hidiffusion.py","lineNumber":1113,"sourceCode":"                    )\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                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            elif self.config.addition_embed_type == \"image\":\n                # Kandinsky 2.2 - style\n                if \"image_embeds\" not in added_cond_kwargs:\n                    raise ValueError(\n                        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`\"\n                    )\n                image_embs = added_cond_kwargs.get(\"image_embeds\")\n                aug_emb = self.add_embedding(image_embs)\n            elif self.config.addition_embed_type == \"image_hint\":\n                # Kandinsky 2.2 - style\n                if \"image_embeds\" not in added_cond_kwargs or \"hint\" not in added_cond_kwargs:\n                    raise ValueError(\n                        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`\"\n                    )\n                image_embs = added_cond_kwargs.get(\"image_embeds\")\n                hint = added_cond_kwargs.get(\"hint\")\n                aug_emb, hint = self.add_embedding(image_embs, hint)\n                sample = torch.cat([sample, hint], dim=1)\n\n            emb = emb + aug_emb if aug_emb is not None else emb\n\n            if self.time_embed_act is not None:\n                emb = self.time_embed_act(emb)\n\n            if self.encoder_hid_proj is not None and self.config.encoder_hid_dim_type == \"text_proj\":\n                encoder_hidden_states = self.encoder_hid_proj(encoder_hidden_states)\n            elif self.encoder_hid_proj is not None and self.config.encoder_hid_dim_type == \"text_image_proj\":\n                # Kadinsky 2.1 - style\n                if \"image_embeds\" not in added_cond_kwargs:\n                    raise ValueError(","sourceCodeStart":1095,"sourceCodeEnd":1131,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/backend/hidiffusion/hidiffusion.py#L1095-L1131","documentation":"For `addition_embed_type='image_hint'` (Kandinsky 2.2 ControlNet-style), forward requires both `added_cond_kwargs['image_embeds']` and `added_cond_kwargs['hint']`; the hint is concatenated to the sample channels and the embedding module returns both `aug_emb` and the processed hint. Either key missing triggers this error.","triggerScenarios":"Calling forward on a UNet with `config.addition_embed_type == 'image_hint'` where `added_cond_kwargs` lacks `image_embeds` or `hint` (or is absent).","commonSituations":"Using a Kandinsky 2.2 hint/control checkpoint with a plain sampling loop that passes only image embeds or no extra kwargs; forgetting the control/hint image tensor; confusing 'image' and 'image_hint' embed types when swapping checkpoints.","solutions":["Pass both keys: `added_cond_kwargs={'image_embeds': image_embeds, 'hint': hint}`","Provide the hint as a tensor with the channel count the embedding expects (check `add_embedding` / config `in_channels` concatenation)","If no hint conditioning is needed, load the non-hint Kandinsky 2.2 UNet (`addition_embed_type='image'`)"],"exampleFix":"// before\nunet(sample, t, emb, added_cond_kwargs={'image_embeds': image_embeds})\n// after\nunet(sample, t, emb, added_cond_kwargs={'image_embeds': image_embeds, 'hint': hint})","handlingStrategy":"validation","validationCode":"if getattr(unet.config, 'addition_embed_type', None) == 'image_hint' and not (added_cond_kwargs and 'image_embeds' in added_cond_kwargs and 'hint' in added_cond_kwargs):\n    raise ValueError(\"image_hint UNet requires added_cond_kwargs with both 'image_embeds' and 'hint'\")","typeGuard":"def has_hint_pair(added_cond_kwargs) -> bool:\n    return isinstance(added_cond_kwargs, dict) and {'image_embeds', 'hint'} <= added_cond_kwargs.keys()","tryCatchPattern":"try:\n    out = unet(sample, t, emb, added_cond_kwargs=ackw)\nexcept ValueError as e:\n    if 'image_hint' in str(e):\n        ackw = {'image_embeds': image_embeds, 'hint': hint}; out = unet(sample, t, emb, added_cond_kwargs=ackw)\n    else: raise","preventionTips":["Verify the hint tensor matches the channel count the UNet concatenates onto `sample`","Never swap 'image' and 'image_hint' checkpoints without updating kwargs","Prefer the Kandinsky ControlNet pipeline for hint-conditioned inference"],"tags":["diffusers","unet","kandinsky","missing-argument","controlnet"],"backgroundTag":"missing-required-argument","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}