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

When doing text-to-image (no initial latents), the diffusion schedule starts from pure noise, so partial denoising is meaningless. _run_diffusion raises if denoising_start is set (greater than 1e-5) while init_latents are absent.

Source

Thrown at invokeai/app/invocations/cogview4_denoise.py:262

        # Load the input latents, if provided.
        init_latents = context.tensors.load(self.latents.latents_name) if self.latents else None
        if init_latents is not None:
            init_latents = init_latents.to(device=device, dtype=inference_dtype)

        # Generate initial latent noise.
        num_channels_latents = transformer_info.model.config.in_channels  # type: ignore
        assert isinstance(num_channels_latents, int)
        noise = self._prepare_noise_tensor(context, num_channels_latents, inference_dtype, device)

        # Prepare input latent image.
        if init_latents is not None:
            # Noise the init_latents by the appropriate amount for the first timestep.
            s_0 = sigmas[0]
            latents = s_0 * noise + (1.0 - s_0) * init_latents
        else:
            # init_latents are not provided, so we are not doing image-to-image (i.e. we are starting from pure noise).
            if self.denoising_start > 1e-5:
                raise ValueError("denoising_start should be 0 when initial latents are not provided.")
            latents = noise

        # If len(timesteps) == 1, then short-circuit. We are just noising the input latents, but not taking any
        # denoising steps.
        if len(timesteps) <= 1:
            return latents

        # Prepare inpaint extension.
        inpaint_mask = self._prep_inpaint_mask(context, latents)
        inpaint_extension: RectifiedFlowInpaintExtension | None = None
        if inpaint_mask is not None:
            assert init_latents is not None
            inpaint_extension = RectifiedFlowInpaintExtension(
                init_latents=init_latents,
                inpaint_mask=inpaint_mask,
                noise=noise,
            )

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Set denoising_start to 0 on the denoise node.
  2. Connect initial latents (via an image-to-latents/vae encoder path) if img2img behavior is desired.
  3. Fix graph-building code to set denoising_start only when init latents are provided.

Example fix

// before
node.denoising_start = 0.4  # but no init_latents connected
// after
node.denoising_start = 0.0  # or connect latents from ImageToLatents
Defensive patterns

Strategy: validation

Validate before calling

if node.latents is None and node.denoising_start > 1e-5:
    node.denoising_start = 0.0

Try / catch

try:
    output = node.invoke(context)
except ValueError as e:
    if "denoising_start" in str(e):
        node.denoising_start = 0.0
        output = node.invoke(context)
    else:
        raise

Prevention

When it happens

Trigger: Invoking CogView4 denoise with denoising_start > 1e-5 in a graph that has no initial latents connected (pure text-to-image).

Common situations: Reusing an img2img graph template after disconnecting the image/latents input; programmatic graph construction that sets denoising_start unconditionally; UI copy that keeps the slider value after the input image is removed.

Related errors


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