invoke-ai/InvokeAI · error · ValueError

denoising_start should be 0 when initial latents are not pro

Error message

denoising_start should be 0 when initial latents are not provided.

What it means

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.

Source

Thrown at invokeai/app/invocations/flux2_denoise.py:348

        # Prepare input latent image
        if init_latents is not None:
            if self.add_noise:
                assert noise is not None
                # Noise the init latents using the first timestep from the clipped
                # InvokeAI schedule.
                #
                # Known limitation: if a scheduler later uses a different first
                # effective timestep/sigma than this precomputed schedule, the
                # img2img preblend below may not match that scheduler exactly.
                # This is an existing pipeline limitation and applies to both
                # seed-generated noise and externally supplied noise.
                t_0 = timesteps[0]
                x = t_0 * noise + (1.0 - t_0) * init_latents
            else:
                x = init_latents
        else:
            if self.denoising_start > 1e-5:
                raise ValueError("denoising_start should be 0 when initial latents are not provided.")
            assert noise is not None
            x = noise

        # If len(timesteps) == 1, then short-circuit
        if len(timesteps) <= 1:
            return x

        # Generate image position IDs (FLUX.2 uses 4D coordinates)
        # Position IDs use int64 dtype like diffusers
        img_ids = generate_img_ids_flux2(h=latent_h, w=latent_w, batch_size=b, device=device)

        # Prepare inpaint mask
        inpaint_mask = self._prep_inpaint_mask(context, x)

        # Pack all latent tensors
        init_latents_packed = pack_flux2(init_latents) if init_latents is not None else None
        inpaint_mask_packed = pack_flux2(inpaint_mask) if inpaint_mask is not None else None
        noise_packed = pack_flux2(noise) if noise is not None else None

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Connect your VAE-encoded latents to the denoise invocation's latent input if you want partial denoising
  2. Set denoising_start to 0 when running pure text-to-image (no initial latents)
  3. If using timesteps/sigmas custom schedule, confirm denoising_start is 0 when starting from noise

Example fix

# before
denoise.denoising_start = 0.7
denoise.latent = None  # no init latents
# after
denoise.denoising_start = 0.7
denoise.latent = vae_encode(image).latent  # wire init latents
# or: denoise.denoising_start = 0
Defensive patterns

Strategy: validation

Validate before calling

if initial_latents is None and denoising_start > 1e-5:
    raise ValueError('set denoising_start=0 or provide initial latents')

Try / catch

try:
    out = denoise.invoke(context)
except ValueError as e:
    if 'denoising_start should be 0' in str(e):
        denoise.denoising_start = 0
        out = denoise.invoke(context)
    else:
        raise

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29). Data as JSON: /api/errors/b60ba02e18db1e1c. Report an issue: GitHub.