invoke-ai/InvokeAI · error · ValueError

End-image (FLF2V) interpolation is only supported for I2V-A1

Error message

End-image (FLF2V) interpolation is only supported for I2V-A14B video (num_frames > 1). Got {'TI2V-5B' if is_ti2v_5b else 'single-frame I2V'}. Remove the End Image input, or use an A14B VAE with num_frames > 1.

What it means

First-last-frame (FLF2V) interpolation — encoding both a start and an end image into a 20-channel mask+latent condition — is only implemented for the Wan 2.2 I2V-A14B path with multi-frame output. It is rejected for the TI2V-5B VAE (z_dim == 48, single-frame 48-channel condition) and for single-frame I2V. InvokeAI raises ValueError to prevent silently dropping the end image.

Source

Thrown at invokeai/app/invocations/wan_ref_image_encoder.py:152

            device = get_effective_device(vae)
            target_dtype = TorchDevice.choose_bfloat16_safe_dtype(device)
            context.util.signal_progress(
                ("VAE-encoding FLF2V start+end images" if end_pil_image is not None else "VAE-encoding reference image")
                + (f" ({self.num_frames} frames)" if self.num_frames > 1 else "")
            )
            # Free cached allocator blocks left over from earlier nodes (denoise expert
            # swaps in particular can leave the cache fragmented in ways that look like
            # free VRAM but fail a single large contiguous request). Mirrors the
            # pattern used in wan_latents_to_image.py / wan_latents_to_video.py.
            TorchDevice.empty_cache()
            # Pick the encoder path by VAE z_dim: 48 means the Wan 2.2-VAE (TI2V-5B),
            # which uses a single-frame 48-channel condition that the denoise loop
            # blends with the noisy latents at every step (expand_timesteps path).
            # 16 means the standard Wan VAE (A14B), which uses the 20-channel
            # mask + latent condition concatenated to noise along the channel dim.
            is_ti2v_5b = getattr(vae.config, "z_dim", 16) == 48
            if end_pil_image is not None and (is_ti2v_5b or self.num_frames <= 1):
                raise ValueError(
                    "End-image (FLF2V) interpolation is only supported for I2V-A14B video "
                    f"(num_frames > 1). Got {'TI2V-5B' if is_ti2v_5b else 'single-frame I2V'}. "
                    "Remove the End Image input, or use an A14B VAE with num_frames > 1."
                )
            if is_ti2v_5b:
                # TI2V-5B I2V needs latent H/W to be even for the transformer
                # patch_size=(1,2,2), so pixel dims must be multiples of 32
                # (16x VAE * 2 transformer patch). A14B's 8x VAE only needed
                # multiples of 16.
                if self.width % 32 != 0 or self.height % 32 != 0:
                    raise ValueError(
                        f"TI2V-5B I2V requires width and height to be multiples of 32 "
                        f"(got {self.width}x{self.height}). The Wan 2.2-VAE uses 16x "
                        f"spatial compression and the transformer adds a 2x patch on "
                        f"top, so pixel dims must divide by 32 for the patchify step."
                    )
                condition = encode_reference_image_to_ti2v_condition(
                    image=pil_image,

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Switch to the Wan 2.2 I2V-A14B VAE (and matching A14B transformer).
  2. Set num_frames > 1 and satisfy (num_frames - 1) % 4 == 0 (e.g. 81).
  3. Remove the End Image input if you must stay on TI2V-5B or single-frame mode.

Example fix

// before
vae = ti2v_5b_vae; end_image = img; num_frames = 1
// after
vae = i2v_a14b_vae; end_image = img; num_frames = 81
Defensive patterns

Strategy: validation

Validate before calling

flf2v_ok = end_image is None or (
    getattr(vae.config, "z_dim", 16) == 16 and num_frames > 1
)
if not flf2v_ok:
    end_image = None  # or switch to A14B VAE + multi-frame

Try / catch

try:
    out = encoder.invoke(context)
except ValueError as e:
    if "End-image (FLF2V) interpolation" in str(e):
        end_image = None  # degrade to I2V without last frame
    else:
        raise

Prevention

When it happens

Trigger: Supplying an End Image to wan_ref_image_encoder while either (a) the loaded VAE is TI2V-5B (z_dim 48) or (b) num_frames <= 1.

Common situations: Users expect FLF2V to work with the smaller TI2V-5B model, or leave num_frames at 1 while adding an end image expecting an interpolated pair.

Related errors


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