{"record":{"id":"2686a13f62366854","repo":"Comfy-Org/ComfyUI","slug":"moge-geometry-has-no-mask-output","errorCode":null,"errorMessage":"moge_geometry has no mask output.","messagePattern":"moge_geometry has no mask output\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_extras/nodes_moge.py","lineNumber":302,"sourceCode":"    def execute(cls, moge_geometry, output) -> io.NodeOutput:\n        is_normal = output in (\"normal_directx\", \"normal_opengl\")\n        opengl = output.endswith(\"_opengl\")\n\n        # Pick the input tensor for the chosen mode and validate availability.\n        if output in (\"depth\", \"depth_colored\"):\n            if \"depth\" not in moge_geometry:\n                raise ValueError(\"moge_geometry has no depth output.\")\n            src = moge_geometry[\"depth\"]\n        elif is_normal:\n            if \"normal\" in moge_geometry:\n                src = moge_geometry[\"normal\"]\n            elif \"points\" in moge_geometry:\n                src = moge_geometry[\"points\"]\n            else:\n                raise ValueError(\"moge_geometry has neither normals nor points to derive normals from.\")\n        elif output == \"mask\":\n            if \"mask\" not in moge_geometry:\n                raise ValueError(\"moge_geometry has no mask output.\")\n            src = moge_geometry[\"mask\"]\n        else:\n            raise ValueError(f\"Unknown output mode: {output}\")\n\n        B = src.shape[0]\n        pbar = comfy.utils.ProgressBar(B)\n        out: list[torch.Tensor] = []\n        with tqdm(total=B, desc=f\"MoGe render: {output}\") as tq:\n            for i in range(B):\n                slc = src[i:i + 1].float()\n                if output in (\"depth\", \"depth_colored\"):\n                    d = _normalize_disparity(slc)\n                    out.append(_turbo(d) if output == \"depth_colored\"\n                               else d.unsqueeze(-1).expand(*d.shape, 3).contiguous())\n                elif is_normal:\n                    n = slc if \"normal\" in moge_geometry else _normals_from_points(slc)\n                    # MoGe is OpenCV (Z+ into scene); normal-map convention is Z+ out of surface, so flip Z.\n                    y_sign = -1.0 if opengl else 1.0","sourceCodeStart":284,"sourceCodeEnd":320,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_extras/nodes_moge.py#L284-L320","documentation":"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.","triggerScenarios":"output='mask' with a geometry dict lacking 'mask', typical when inference was run without mask generation or the geometry was constructed manually.","commonSituations":"Switching render modes after a depth-only inference; composing geometry dicts from partial sources.","solutions":["Enable mask output in the upstream MoGe inference node and re-run.","Choose a render mode matching the available keys.","Check 'mask' in moge_geometry before setting output='mask'."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if output == 'mask' and 'mask' not in moge_geometry:\n    raise UserFacingError('re-run inference with mask enabled')","typeGuard":"def geometry_has_mask(geo) -> bool:\n    return 'mask' in geo","tryCatchPattern":null,"preventionTips":["Enable mask generation upstream when mask rendering is required.","Validate dict keys before choosing the output mode."],"tags":["moge","mask","dict-keys","render"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}