Comfy-Org/ComfyUI · error · ValueError

moge_geometry has no mask output.

Error message

moge_geometry has no mask output.

What it means

The mask render mode requires the 'mask' key in the moge_geometry dict. Masks are an optional inference product; requesting them from a run that did not produce one fails this validation before tensor work begins.

Source

Thrown at comfy_extras/nodes_moge.py:302

    def execute(cls, moge_geometry, output) -> io.NodeOutput:
        is_normal = output in ("normal_directx", "normal_opengl")
        opengl = output.endswith("_opengl")

        # Pick the input tensor for the chosen mode and validate availability.
        if output in ("depth", "depth_colored"):
            if "depth" not in moge_geometry:
                raise ValueError("moge_geometry has no depth output.")
            src = moge_geometry["depth"]
        elif is_normal:
            if "normal" in moge_geometry:
                src = moge_geometry["normal"]
            elif "points" in moge_geometry:
                src = moge_geometry["points"]
            else:
                raise ValueError("moge_geometry has neither normals nor points to derive normals from.")
        elif output == "mask":
            if "mask" not in moge_geometry:
                raise ValueError("moge_geometry has no mask output.")
            src = moge_geometry["mask"]
        else:
            raise ValueError(f"Unknown output mode: {output}")

        B = src.shape[0]
        pbar = comfy.utils.ProgressBar(B)
        out: list[torch.Tensor] = []
        with tqdm(total=B, desc=f"MoGe render: {output}") as tq:
            for i in range(B):
                slc = src[i:i + 1].float()
                if output in ("depth", "depth_colored"):
                    d = _normalize_disparity(slc)
                    out.append(_turbo(d) if output == "depth_colored"
                               else d.unsqueeze(-1).expand(*d.shape, 3).contiguous())
                elif is_normal:
                    n = slc if "normal" in moge_geometry else _normals_from_points(slc)
                    # MoGe is OpenCV (Z+ into scene); normal-map convention is Z+ out of surface, so flip Z.
                    y_sign = -1.0 if opengl else 1.0

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Enable mask output in the upstream MoGe inference node and re-run.
  2. Choose a render mode matching the available keys.
  3. Check 'mask' in moge_geometry before setting output='mask'.
Defensive patterns

Strategy: validation

Validate before calling

if output == 'mask' and 'mask' not in moge_geometry:
    raise UserFacingError('re-run inference with mask enabled')

Type guard

def geometry_has_mask(geo) -> bool:
    return 'mask' in geo

Prevention

When it happens

Trigger: output='mask' with a geometry dict lacking 'mask', typical when inference was run without mask generation or the geometry was constructed manually.

Common situations: Switching render modes after a depth-only inference; composing geometry dicts from partial sources.

Related errors


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