{"record":{"id":"2c733366a6a3f27d","repo":"BabylonJS/Babylon.js","slug":"unsupported-splat-mode","errorCode":null,"errorMessage":"Unsupported Splat mode","messagePattern":"Unsupported Splat mode","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/loaders/src/SPLAT/splatFileLoader.pure.ts","lineNumber":374,"sourceCode":"                                await pointcloud.buildMeshAsync().then((mesh) => {\r\n                                    babylonMeshesArray.push(mesh);\r\n                                });\r\n                            } else {\r\n                                pointcloud.dispose();\r\n                            }\r\n                        }\r\n                        break;\r\n                    case Mode.Mesh:\r\n                        {\r\n                            if (parsedPLY.faces) {\r\n                                babylonMeshesArray.push(SPLATFileLoader._BuildMesh(scene, parsedPLY));\r\n                            } else {\r\n                                throw new Error(\"PLY mesh doesn't contain face informations.\");\r\n                            }\r\n                        }\r\n                        break;\r\n                    default:\r\n                        throw new Error(\"Unsupported Splat mode\");\r\n                }\r\n                scene._blockEntityCollection = false;\r\n                this.applyAutoCameraLimits(SPLATFileLoader._ExtractSafeOrbitLimits(parsedPLY), scene);\r\n                resolve(babylonMeshesArray);\r\n            });\r\n        };\r\n\r\n        // Check for gzip (before SPZ V4) and NGSP (SPZ V4+) magic bytes to detect SPZ format\r\n        const isGZipped = u8[0] === 0x1f && u8[1] === 0x8b;\r\n        const isNGSP = u8[0] === 0x4e && u8[1] === 0x47 && u8[2] === 0x53 && u8[3] === 0x50;\r\n        if (!isGZipped && !isNGSP) {\r\n            return new Promise((resolve) => {\r\n                handlePLY(resolve);\r\n            });\r\n        }\r\n\r\n        const applyParsedSPZ = (parsedSPZ: IParsedSplat, resolve: (meshes: typeof babylonMeshesArray) => void) => {\r\n            scene._blockEntityCollection = !!this._assetContainer;\r","sourceCodeStart":356,"sourceCodeEnd":392,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/loaders/src/SPLAT/splatFileLoader.pure.ts#L356-L392","documentation":"Thrown by handlePLY when the SPLAT loader encounters a mode value that is not one of the supported Mode enum values. The mode controls how the PLY/SPLAT data is interpreted (points, mesh, splat), and any unrecognized mode falls into the default branch. This usually means an invalid or typo'd Mode value was passed.","triggerScenarios":"Constructing SPLATFileLoader with a mode value not in the Mode enum, or passing a numeric/cast value that hits the switch's default branch in handlePLY.","commonSituations":"Typo like Mode.mesh instead of Mode.Mesh; passing a raw number from config; upgrading Babylon.js where a Mode member was renamed or removed.","solutions":["Use only members of the exported Mode enum (e.g. Mode.Mesh, Mode.Point, Mode.Splat)","Check for typos or case mistakes in the mode value","Verify against the Babylon.js version in use that the Mode member still exists","Pass the enum member, not a raw number from external config"],"exampleFix":"// before\nconst loader = new SPLATFileLoader(\"mesh\" as any);\n// after\nconst loader = new SPLATFileLoader(Mode.Mesh);","handlingStrategy":"type-guard","validationCode":"const SUPPORTED = new Set(Object.values(Mode));\nif (!SUPPORTED.has(mode)) throw new Error(`Unsupported SPLAT mode: ${mode}`);","typeGuard":"function isSplatMode(m: unknown): m is Mode {\n  return typeof m === 'number' && Object.values(Mode).includes(m as Mode);\n}","tryCatchPattern":"try {\n  await loader.loadAsync(url);\n} catch (e) {\n  if (e instanceof Error && e.message === \"Unsupported Splat mode\") {\n    console.error(`Invalid mode value; use Mode enum members, got:`, mode);\n  } else throw e;\n}","preventionTips":["Always pass Mode enum members, never raw numbers or strings from config","Add a unit test asserting the configured mode isSplatMode","Recheck mode constants after Babylon.js upgrades"],"tags":["splat","loader","invalid-argument"],"backgroundTag":"unsupported-enum-value","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}