{"record":{"id":"90868b170503df6c","repo":"invoke-ai/InvokeAI","slug":"a-vae-e-g-controlnet-vae-must-be-provided-to-u","errorCode":null,"errorMessage":"A VAE (e.g., controlnet_vae) must be provided to use Kontext conditioning.","messagePattern":"A VAE \\(e\\.g\\., controlnet_vae\\) must be provided to use Kontext conditioning\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/app/invocations/flux_denoise.py","lineNumber":402,"sourceCode":"        # Compute the IP-Adapter image prompt clip embeddings.\n        # We do this before loading other models to minimize peak memory.\n        # TODO(ryand): We should really do this in a separate invocation to benefit from caching.\n        ip_adapter_fields = self._normalize_ip_adapter_fields()\n        pos_image_prompt_clip_embeds, neg_image_prompt_clip_embeds = self._prep_ip_adapter_image_prompt_clip_embeds(\n            ip_adapter_fields, context, device=x.device\n        )\n\n        cfg_scale = self.prep_cfg_scale(\n            cfg_scale=self.cfg_scale,\n            timesteps=timesteps,\n            cfg_scale_start_step=self.cfg_scale_start_step,\n            cfg_scale_end_step=self.cfg_scale_end_step,\n        )\n\n        kontext_extension = None\n        if self.kontext_conditioning:\n            if not self.controlnet_vae:\n                raise ValueError(\"A VAE (e.g., controlnet_vae) must be provided to use Kontext conditioning.\")\n\n            kontext_extension = KontextExtension(\n                context=context,\n                kontext_conditioning=self.kontext_conditioning\n                if isinstance(self.kontext_conditioning, list)\n                else [self.kontext_conditioning],\n                vae_field=self.controlnet_vae,\n                device=device,\n                dtype=inference_dtype,\n            )\n\n        with ExitStack() as exit_stack:\n            # Prepare ControlNet extensions.\n            # Note: We do this before loading the transformer model to minimize peak memory (see implementation).\n            controlnet_extensions = self._prep_controlnet_extensions(\n                context=context,\n                exit_stack=exit_stack,\n                latent_height=latent_h,","sourceCodeStart":384,"sourceCodeEnd":420,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/invocations/flux_denoise.py#L384-L420","documentation":"Kontext conditioning feeds a reference image into the FLUX transformer, which requires encoding that image through a VAE. The invocation only has a VAE if controlnet_vae is supplied, so when kontext_conditioning is set but controlnet_vae is None it cannot perform the required image-to-latent encoding and raises.","triggerScenarios":"Setting the kontext_conditioning field on FLUX Denoise without connecting a VAE to the controlnet_vae field; the check happens in _run_diffusion before building the KontextExtension.","commonSituations":"Wiring a Kontext reference image but forgetting the auxiliary controlnet_vae input; workflows copied from examples that omit the VAE node; using a model bundle that doesn't include a VAE for Kontext.","solutions":["Connect a FLUX-compatible VAE to the controlnet_vae field of the FLUX Denoise invocation.","Remove the kontext_conditioning input if Kontext conditioning is not intended.","Verify the workflow includes the VAE loader node feeding the denoise node's controlnet_vae input."],"exampleFix":"// before\ndenoise.kontext_conditioning = refImageField; // controlnet_vae unset\n// after\ndenoise.controlnet_vae = vaeField; // VAE required for Kontext image encoding","handlingStrategy":"validation","validationCode":"if denoise.kontext_conditioning is not None and denoise.controlnet_vae is None:\n    raise ValueError(\"Kontext conditioning requires a controlnet_vae\")","typeGuard":"def kontext_ready(denoise) -> bool:\n    return denoise.kontext_conditioning is None or denoise.controlnet_vae is not None","tryCatchPattern":"try:\n    result = invoke(denoise)\nexcept ValueError as e:\n    if 'must be provided to use Kontext conditioning' in str(e):\n        denoise.controlnet_vae = load_vae()\n        result = invoke(denoise)\n    else:\n        raise","preventionTips":["Always pair kontext_conditioning with a FLUX VAE loader node","Validate graph inputs (required edges connected) before invoking","Keep reference workflows with the VAE node intact"],"tags":["flux","kontext","vae","missing-input"],"backgroundTag":"missing-required-input","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}