Comfy-Org/ComfyUI · error · RuntimeError

ERROR: clip input is invalid: None\n\nIf the clip is from a

Error message

ERROR: clip input is invalid: None\n\nIf the clip is from a checkpoint loader node your checkpoint does not contain a valid clip or text encoder model.

What it means

CLIPTextEncode.encode receives the CLIP/text-encoder object from a checkpoint loader; when the loaded checkpoint contains no valid CLIP weights the loader passes None downstream, and this node raises a RuntimeError explaining the checkpoint lacks a text encoder model rather than crashing on None.tokenize().

Source

Thrown at nodes.py:75

    @classmethod
    def INPUT_TYPES(s) -> InputTypeDict:
        return {
            "required": {
                "text": (IO.STRING, {"multiline": True, "dynamicPrompts": True, "tooltip": "The text to be encoded."}),
                "clip": (IO.CLIP, {"tooltip": "The CLIP model used for encoding the text."})
            }
        }
    RETURN_TYPES = (IO.CONDITIONING,)
    OUTPUT_TOOLTIPS = ("A conditioning containing the embedded text used to guide the diffusion model.",)
    FUNCTION = "encode"

    CATEGORY = "model/conditioning"
    DESCRIPTION = "Encodes a text prompt using a CLIP model into an embedding that can be used to guide the diffusion model towards generating specific images."
    SEARCH_ALIASES = ["text", "prompt", "text prompt", "positive prompt", "negative prompt", "encode text", "text encoder", "encode prompt"]

    def encode(self, clip, text):
        if clip is None:
            raise RuntimeError("ERROR: clip input is invalid: None\n\nIf the clip is from a checkpoint loader node your checkpoint does not contain a valid clip or text encoder model.")
        tokens = clip.tokenize(text)
        return (clip.encode_from_tokens_scheduled(tokens), )


class ConditioningCombine:
    ESSENTIALS_CATEGORY = "Image Generation"
    @classmethod
    def INPUT_TYPES(s):
        return {"required": {"conditioning_1": ("CONDITIONING", ), "conditioning_2": ("CONDITIONING", )}}
    RETURN_TYPES = ("CONDITIONING",)
    FUNCTION = "combine"

    CATEGORY = "model/conditioning/transform"
    SEARCH_ALIASES = ["combine", "merge conditioning", "combine prompts", "merge prompts", "mix prompts", "add prompt"]

    def combine(self, conditioning_1, conditioning_2):
        return (conditioning_1 + conditioning_2, )

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Use a full checkpoint that bundles a text encoder, or load CLIP separately with CLIPLoader (and VAE with VAELoader) for diffusion-only checkpoints
  2. Wire the CLIP output of the correct loader node into the text encode node
  3. Inspect the checkpoint's state dict keys for a 'clip'/'conditioner' text-encoder subtree if unsure

Example fix

# before: diffusion-only checkpoint via CheckpointLoaderSimple
clip = CheckpointLoaderSimple(...).clip  # None
cond = CLIPTextEncode().encode(clip, "a cat")

# after: dedicated loaders for unet-style checkpoints
clip = CLIPLoader().load("t5xxl_fp8.safetensors", "wan")
cond = CLIPTextEncode().encode(clip, "a cat")
Defensive patterns

Strategy: type-guard

Validate before calling

if clip is None:
    raise RuntimeError("checkpoint has no CLIP; use CLIPLoader for diffusion-only checkpoints")

Type guard

def has_clip(ckpt_output) -> bool:
    return getattr(ckpt_output, "clip", None) is not None

Try / catch

try:
    cond = CLIPTextEncode().encode(clip, text)
except RuntimeError as e:
    if "clip input is invalid" in str(e):
        # switch to CLIPLoader-based graph
        raise

Prevention

When it happens

Trigger: Loading a diffusion-only or VAE-only checkpoint (e.g. a raw unet/diffusion-model safetensors renamed as a checkpoint) into CheckpointLoaderSimple, then wiring its CLIP output into CLIPTextEncode; also clip_weight_dtype or clip skip setups where the loader deliberately yields None.

Common situations: Using a DiT/flow model checkpoint without an embedded text encoder (needs a separate CLIPLoader); mixing up CheckpointLoaderSimple with models that require dual text encoders loaded separately; corrupted or partial checkpoint files missing the clip_weights tree.

Related errors


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