{"record":{"id":"b60ba02e18db1e1c","repo":"invoke-ai/InvokeAI","slug":"denoising-start-should-be-0-when-initial-latents-a-b60ba0","errorCode":null,"errorMessage":"denoising_start should be 0 when initial latents are not provided.","messagePattern":"denoising_start should be 0 when initial latents are not provided\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"invokeai/app/invocations/flux2_denoise.py","lineNumber":348,"sourceCode":"        # Prepare input latent image\n        if init_latents is not None:\n            if self.add_noise:\n                assert noise is not None\n                # Noise the init latents using the first timestep from the clipped\n                # InvokeAI schedule.\n                #\n                # Known limitation: if a scheduler later uses a different first\n                # effective timestep/sigma than this precomputed schedule, the\n                # img2img preblend below may not match that scheduler exactly.\n                # This is an existing pipeline limitation and applies to both\n                # seed-generated noise and externally supplied noise.\n                t_0 = timesteps[0]\n                x = t_0 * noise + (1.0 - t_0) * init_latents\n            else:\n                x = init_latents\n        else:\n            if self.denoising_start > 1e-5:\n                raise ValueError(\"denoising_start should be 0 when initial latents are not provided.\")\n            assert noise is not None\n            x = noise\n\n        # If len(timesteps) == 1, then short-circuit\n        if len(timesteps) <= 1:\n            return x\n\n        # Generate image position IDs (FLUX.2 uses 4D coordinates)\n        # Position IDs use int64 dtype like diffusers\n        img_ids = generate_img_ids_flux2(h=latent_h, w=latent_w, batch_size=b, device=device)\n\n        # Prepare inpaint mask\n        inpaint_mask = self._prep_inpaint_mask(context, x)\n\n        # Pack all latent tensors\n        init_latents_packed = pack_flux2(init_latents) if init_latents is not None else None\n        inpaint_mask_packed = pack_flux2(inpaint_mask) if inpaint_mask is not None else None\n        noise_packed = pack_flux2(noise) if noise is not None else None","sourceCodeStart":330,"sourceCodeEnd":366,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/invocations/flux2_denoise.py#L330-L366","documentation":"In the FLUX.2 denoise step, when no initial latents are supplied the process must start from pure noise at the first timestep, so any non-trivial denoising_start is meaningless. _run_diffusion raises ValueError if denoising_start > 1e-5 in that case.","triggerScenarios":"Invoking Flux2DenoiseInvocation with initial_latents (latent input) left unconnected while denoising_start is set to a value > 1e-5 (e.g. 0.7 for img2img-style partial denoise).","commonSituations":"Building an img2img workflow but forgetting to wire the latent input into the denoise node; reusing a graph where the latents link was deleted; UI default denoising_start > 0 with a text-to-image pipeline.","solutions":["Connect your VAE-encoded latents to the denoise invocation's latent input if you want partial denoising","Set denoising_start to 0 when running pure text-to-image (no initial latents)","If using timesteps/sigmas custom schedule, confirm denoising_start is 0 when starting from noise"],"exampleFix":"# before\ndenoise.denoising_start = 0.7\ndenoise.latent = None  # no init latents\n# after\ndenoise.denoising_start = 0.7\ndenoise.latent = vae_encode(image).latent  # wire init latents\n# or: denoise.denoising_start = 0","handlingStrategy":"validation","validationCode":"if initial_latents is None and denoising_start > 1e-5:\n    raise ValueError('set denoising_start=0 or provide initial latents')","typeGuard":null,"tryCatchPattern":"try:\n    out = denoise.invoke(context)\nexcept ValueError as e:\n    if 'denoising_start should be 0' in str(e):\n        denoise.denoising_start = 0\n        out = denoise.invoke(context)\n    else:\n        raise","preventionTips":["Wire the latent input whenever denoising_start > 0","Default denoising_start to 0 for text-to-image templates","Validate denoising_start/latent pairing in workflow preflight checks"],"tags":["validation","diffusion","latents"],"backgroundTag":"invalid-denoise-parameters","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}