{"record":{"id":"8a8df750246448fb","repo":"Comfy-Org/ComfyUI","slug":"file3dtosplat-could-not-determine-splat-format-fr","errorCode":null,"errorMessage":"File3DToSplat: could not determine splat format from contents","messagePattern":"File3DToSplat: could not determine splat format from contents","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_extras/nodes_gaussian_splat.py","lineNumber":406,"sourceCode":"        w = np.sqrt(np.clip(1.0 - (xq ** 2).sum(1), 0, None))\n        rot = _norm_quat(np.concatenate([w[:, None], xq], 1))                    # wxyz\n    return xyz, scale, rot, alpha, _rgb_to_sh_dc(rgb)\n\n\n_GAUSSIAN_PARSERS = {\"ply\": _parse_ply_gaussian, \"splat\": _parse_splat_gaussian,\n                     \"ksplat\": _parse_ksplat_gaussian, \"spz\": _parse_spz_gaussian}\n\n\ndef _detect_splat_format(data: bytes) -> str:\n    if data[:3] == b'ply':\n        return \"ply\"\n    if data[:2] == b'\\x1f\\x8b':            # gzip -> spz\n        return \"spz\"\n    if len(data) >= 2 and data[0] == 0 and data[1] >= 1:   # ksplat version 0.x header\n        return \"ksplat\"\n    if len(data) % 32 == 0:\n        return \"splat\"\n    raise ValueError(\"File3DToSplat: could not determine splat format from contents\")\n\n\ndef _gaussian_item(g: Types.SPLAT, i: int, device):\n    # Slice batch item i to its real length, as float32 torch tensors on `device` (SH DC -> base RGB).\n    end = _real_len(g, i)\n    to = lambda a: a.to(device=device, dtype=torch.float32)\n    xyz = to(g.positions[i, :end])\n    rgb = (to(g.sh[i, :end, 0, :]) * _C0 + 0.5).clamp(0, 1)\n    opacity = to(g.opacities[i, :end]).reshape(-1)\n    scale = to(g.scales[i, :end])\n    rot = to(g.rotations[i, :end])\n    return xyz, rgb, opacity, scale, rot\n\n\ndef _quat_to_mat(q):\n    # q: (N, 4) wxyz, normalized -> (N, 3, 3)\n    q = q / q.norm(dim=-1, keepdim=True).clamp_min(1e-12)\n    w, x, y, z = q.unbind(-1)","sourceCodeStart":388,"sourceCodeEnd":424,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_extras/nodes_gaussian_splat.py#L388-L424","documentation":"Raised by _detect_splat_format when the input bytes match none of the four known signatures: 'ply' magic, gzip magic (\\x1f\\x8b), a ksplat 0.x header (byte0 == 0, byte1 >= 1), or a length divisible by 32 (antimatter15 .splat). File3DToSplat sniffs content rather than trusting the extension, so this means the payload is not recognizable as any supported splat format.","triggerScenarios":"File3DToSplat on an arbitrary binary, a non-splat 3D format (obj/glb/las), an empty-ish or misaligned file whose length is not a multiple of 32, or a corrupted splat whose magic bytes were damaged.","commonSituations":"Wrong file connected to the node; a model file from another pipeline; corrupt download that lost its magic bytes; a .splat truncated so the length no longer divides by 32.","solutions":["Confirm the file is one of: PLY (binary_little_endian 3DGS), antimatter15 .splat, mkkellogg .ksplat v0.x, or Niantic .spz.","Re-download/regenerate the file; verify magic bytes with a hex editor (70 6c 79 / 1f 8b / 00 xx).","Convert the asset from its source format to one of the supported ones before loading."],"exampleFix":"null","handlingStrategy":"validation","validationCode":"def sniff_splat_format(data: bytes):\n    if data[:3] == b'ply':\n        return 'ply'\n    if data[:2] == b'\\x1f\\x8b':\n        return 'spz'\n    if len(data) >= 2 and data[0] == 0 and data[1] >= 1:\n        return 'ksplat'\n    if len(data) % 32 == 0:\n        return 'splat'\n    return None\n\nfmt = sniff_splat_format(open(path, 'rb').read())\nif fmt is None:\n    raise ValueError(f'{path} is not a recognized splat format')","typeGuard":"def is_supported_splat_file(data: bytes) -> bool:\n    return sniff_splat_format(data) is not None","tryCatchPattern":"try:\n    fmt = _detect_splat_format(data)\nexcept ValueError as e:\n    if 'could not determine' in str(e):\n        convert_asset_from_source(path)\n    else:\n        raise","preventionTips":["Check magic bytes before loading unknown splat files.","Convert obj/glb/las and other 3D formats in a preprocessing step; File3DToSplat only reads ply/splat/ksplat/spz."],"tags":["gaussian-splatting","format-detection","invalid-input","file-format"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}