Comfy-Org/ComfyUI · error · RuntimeError

ERROR: audio encoder not supported.

Error message

ERROR: audio encoder not supported.

What it means

load_audio_encoder recognizes exactly two state-dict signatures: wav2vec2-style keys (with known embed_dim) and whisper3-style 'model.encoder.embed_positions.weight'. A checkpoint matching neither raises RuntimeError('audio encoder not supported.') — the loader refuses unknown architectures instead of misloading them.

Source

Thrown at comfy/audio_encoders/audio_encoders.py:83

            config = {
                "model_type": "wav2vec2",
                "embed_dim": 768,
                "num_heads": 12,
                "num_layers": 12,
                "conv_norm": False,
                "conv_bias": False,
                "do_normalize": False, # chinese-wav2vec2-base has this False
                "do_stable_layer_norm": False
            }
        else:
            raise RuntimeError("ERROR: audio encoder file is invalid or unsupported embed_dim: {}".format(embed_dim))
    elif "model.encoder.embed_positions.weight" in sd:
        sd = comfy.utils.state_dict_prefix_replace(sd, {"model.": ""})
        config = {
            "model_type": "whisper3",
        }
    else:
        raise RuntimeError("ERROR: audio encoder not supported.")

    audio_encoder = AudioEncoderModel(config)
    m, u = audio_encoder.load_sd(sd)
    if len(m) > 0:
        logging.warning("missing audio encoder: {}".format(m))
    if len(u) > 0:
        logging.warning("unexpected audio encoder: {}".format(u))

    return audio_encoder

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Confirm the file is actually the expected wav2vec2 or whisper3 encoder checkpoint for the node.
  2. Inspect the checkpoint's keys (comfy.utils.load_torch_file then sd.keys()) and compare with the two supported signatures.
  3. Re-export/convert the model, or extend load_audio_encoder with a branch for your architecture.
Defensive patterns

Strategy: validation

Validate before calling

sd = comfy.utils.load_torch_file(path)
keys = set(sd.keys())
is_wav2vec2 = any(k.endswith("self_attn.q_proj.weight") for k in keys)
is_whisper3 = "model.encoder.embed_positions.weight" in keys
if not (is_wav2vec2 or is_whisper3):
    raise SystemExit("unsupported audio encoder architecture")

Type guard

def is_supported_audio_encoder(sd: dict) -> bool:
    ks = set(sd.keys())
    return "model.encoder.embed_positions.weight" in ks or any(
        k.endswith("self_attn.q_proj.weight") for k in ks)

Try / catch

try:
    enc = load_audio_encoder(sd)
except RuntimeError as e:
    if "not supported" in str(e):
        print("supported: wav2vec2 (768/1024) or whisper3 encoders only")
    raise

Prevention

When it happens

Trigger: Loading a whisper (non-v3) checkpoint with different key layout, a CLAP/FLAN-T5 audio encoder, or any audio embedding model whose tensor names differ from wav2vec2/whisper3 conventions.

Common situations: Pointing an audio-capable node at a text encoder or audio classifier by mistake; using a newer/different encoder release (whisper-large-v3 vs v2); safetensors exported from an incompatible transformers version.

Related errors


AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14). Data as JSON: /api/errors/6beafeec40e1f39a. Report an issue: GitHub.