From d4239c8a15db0b743bdfe7d240a96fb5034201ee Mon Sep 17 00:00:00 2001 From: Darksidewalker <> Date: Fri, 30 Oct 2026 19:10:55 +0100 Subject: [PATCH] fix(h3-continuity): Segment Decode names swapped video/audio VAE slots A video VAE (e.g. the new Sol-H3-VAE) wired into audio_vae failed deep in Core's decode with 'tuple index out of range'. Classify both slots by Core's MiniMaxH3VideoVAE/MiniMaxH3AudioVAE classes before decoding, in both output modes, so the error names the wiring and new H3 VAE variants keep passing. --- .github/scripts/test_h3_segment_decode.py | 12 ++++++++++++ nodes/h3_continuity/segment_nodes.py | 11 +++++++++++ nodes/nodes_minimax_h3_director_guide.py | 2 +- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/.github/scripts/test_h3_segment_decode.py b/.github/scripts/test_h3_segment_decode.py index 851754b..cdaa751 100644 --- a/.github/scripts/test_h3_segment_decode.py +++ b/.github/scripts/test_h3_segment_decode.py @@ -139,3 +139,15 @@ def test_full_mode_decode_matches_core_decoders(monkeypatch): assert torch.equal(images,comfy_nodes.VAEDecode().decode(vae,take)[0]) core_audio = vae_decode_audio(avae,take) assert torch.equal(audio['waveform'],core_audio['waveform']) and audio['sample_rate'] == core_audio['sample_rate'] + +@pytest.mark.parametrize('output_mode',['full','segment']) +def test_segment_decode_names_swapped_vae_slots(output_mode): + from comfy.ldm.minimax.audio_vae import MiniMaxH3AudioVAE + mod = importlib.import_module('h3_segment_test.nodes.h3_continuity.segment_nodes') + video = SimpleNamespace(first_stage_model=video_decoder()) + audio = SimpleNamespace(first_stage_model=MiniMaxH3AudioVAE.__new__(MiniMaxH3AudioVAE)) + ctx = {'output_mode':output_mode,'render_kind':'segment'} if output_mode == 'segment' else {'output_mode':'full'} + with pytest.raises(ValueError,match="video VAE is connected to 'audio_vae'"): + mod.DaSiWaH3ContinuitySegmentDecode().decode(None,video,video,ctx) + with pytest.raises(ValueError,match="audio VAE is connected to 'vae'"): + mod.DaSiWaH3ContinuitySegmentDecode().decode(None,audio,audio,ctx) diff --git a/nodes/h3_continuity/segment_nodes.py b/nodes/h3_continuity/segment_nodes.py index 23d7a1e..c95331c 100644 --- a/nodes/h3_continuity/segment_nodes.py +++ b/nodes/h3_continuity/segment_nodes.py @@ -76,6 +76,16 @@ def segment_render_plan(video, audio, context): return plan +def reject_swapped_vaes(vae,audio_vae): + # Classified by Core's model classes, not filenames/keys, so new H3 VAE variants keep passing. + from comfy.ldm.minimax.vae import MiniMaxH3VideoVAE + from comfy.ldm.minimax.audio_vae import MiniMaxH3AudioVAE + if isinstance(getattr(vae,'first_stage_model',None),MiniMaxH3AudioVAE): + raise ValueError("Segment Decode: the H3 audio VAE is connected to 'vae'. Connect an H3 video VAE (e.g. minimax_h3_video_vae_* or minimax_h3_sol_vae_*) to 'vae' and minimax_h3_audio_vae_* to 'audio_vae'.") + if isinstance(getattr(audio_vae,'first_stage_model',None),MiniMaxH3VideoVAE): + raise ValueError("Segment Decode: an H3 video VAE is connected to 'audio_vae'. Connect minimax_h3_audio_vae_* to 'audio_vae' and the video VAE (e.g. minimax_h3_video_vae_* or minimax_h3_sol_vae_*) to 'vae'.") + + def validate_segment_vaes(vae,audio_vae): from comfy.ldm.minimax.vae import MiniMaxH3VideoVAE from comfy.ldm.minimax.audio_vae import MiniMaxH3AudioVAE, BigVGAN, AMPBlock1, Activation1d @@ -119,6 +129,7 @@ class DaSiWaH3ContinuitySegmentDecode: CATEGORY = 'DaSiWa/MiniMax H3' def decode(self, latent, vae, audio_vae, context): + reject_swapped_vaes(vae,audio_vae) if context.get('render_kind') != 'segment': # Full timeline: exactly the core VAE Decode / VAE Decode Audio results. import nodes as comfy_nodes diff --git a/nodes/nodes_minimax_h3_director_guide.py b/nodes/nodes_minimax_h3_director_guide.py index c4c42e3..a0eca28 100644 --- a/nodes/nodes_minimax_h3_director_guide.py +++ b/nodes/nodes_minimax_h3_director_guide.py @@ -49,7 +49,7 @@ def _validate_h3_vaes(vae, audio_vae, mode, *, audio_required=True): if vae_kind == "audio": raise ValueError( "MiniMax H3 Director: Audio VAE is connected to the 'vae' " - "(Video VAE) slot. Connect minimax_h3_video_vae_* to 'vae'." + "(Video VAE) slot. Connect an H3 video VAE (e.g. minimax_h3_video_vae_* or minimax_h3_sol_vae_*) to 'vae'." ) if mode == "REF2VA":