{"record":{"id":"a9e75870acc009a1","repo":"BabylonJS/Babylon.js","slug":"meta-json-not-found-in-files-map","errorCode":null,"errorMessage":"meta.json not found in files Map","messagePattern":"meta\\.json not found in files Map","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/loaders/src/SPLAT/sog.pure.ts","lineNumber":389,"sourceCode":"}\r\n\r\n/**\r\n * Parse SOG data from either a SOGRootData object (with webp files loaded from rootUrl) or from a Map of filenames to Uint8Array file data (including meta.json)\r\n * @param dataOrFiles Either the SOGRootData or a Map of filenames to Uint8Array file data (including meta.json)\r\n * @param rootUrl Base URL to load webp files from (if dataOrFiles is SOGRootData)\r\n * @param scene The Babylon.js scene\r\n * @returns Parsed data\r\n */\r\nexport async function ParseSogMeta(dataOrFiles: SOGRootData | Map<string, Uint8Array>, rootUrl: string, scene: Scene): Promise<IParsedSplat> {\r\n    let data: SOGRootData;\r\n    let files: Map<string, Uint8Array> | undefined;\r\n\r\n    if (dataOrFiles instanceof Map) {\r\n        files = dataOrFiles;\r\n\r\n        const metaFile = files.get(\"meta.json\");\r\n        if (!metaFile) {\r\n            throw new Error(\"meta.json not found in files Map\");\r\n        }\r\n\r\n        data = JSON.parse(new TextDecoder().decode(metaFile)) as SOGRootData;\r\n    } else {\r\n        data = dataOrFiles;\r\n    }\r\n\r\n    // Collect all file names\r\n    const urls = [...data.means.files, ...data.scales.files, ...data.quats.files, ...data.sh0.files];\r\n    if (data.shN) {\r\n        urls.push(...data.shN.files);\r\n    }\r\n\r\n    // Load webp images in parallel\r\n    const imageDataArrays: IWebPImage[] = await Promise.all(\r\n        urls.map(async (fileName) => {\r\n            if (files && files.has(fileName)) {\r\n                // load from in-memory Uint8Array\r","sourceCodeStart":371,"sourceCodeEnd":407,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/loaders/src/SPLAT/sog.pure.ts#L371-L407","documentation":"ParseSogMeta accepts either a parsed SOGRootData object or a Map of filenames to Uint8Array bytes (an unpacked .sog bundle). When given a Map, it looks up the key \"meta.json\" to obtain the root metadata; if that exact key is absent, it cannot parse the bundle and throws. The lookup is exact and case-sensitive.","triggerScenarios":"Calling ParseSogMeta(map, rootUrl, scene) with a Map whose keys don't include the exact string \"meta.json\" — e.g. keys like \"Meta.json\", \"./meta.json\", nested paths, or a Map built from .sog zip entries with prefixed names.","commonSituations":"Manually fetching SOG files and building the Map with wrong key names; unzipping a .sog archive where entry names include a folder prefix; case-sensitive key mismatches after normalizing filenames to lowercase (meta.json becomes fine, but other capitalizations fail).","solutions":["Ensure the Map contains the exact key \"meta.json\" (lowercase, no path prefix).","Normalize keys when building the Map: strip any directory prefix and match case-insensitively to find the meta entry, then insert it under \"meta.json\".","Alternatively parse meta.json yourself and pass the resulting SOGRootData object to ParseSogMeta instead of the Map."],"exampleFix":"// before\nconst files = new Map(entries.map((e) => [e.name, e.data])); // keys like \"bundle/meta.json\"\n// after\nconst files = new Map(entries.map((e) => [e.name.split(\"/\").pop()!, e.data]));\nif (!files.has(\"meta.json\")) throw new Error(\"meta.json missing after normalization\");","handlingStrategy":"type-guard","validationCode":"function requireMetaJson(files) {\n  const meta = files.get('meta.json');\n  if (!meta) {\n    const keys = [...files.keys()].join(', ');\n    throw new Error(`meta.json missing from files Map (keys: ${keys})`);\n  }\n  return meta;\n}","typeGuard":"function hasMetaJson(files) {\n  return files instanceof Map && files.has('meta.json');\n}","tryCatchPattern":"try {\n  return await ParseSogMeta(filesMap, rootUrl, scene);\n} catch (e) {\n  if (e.message.includes('meta.json not found')) {\n    // normalize keys (strip paths, fix case) and retry once, or pass parsed SOGRootData instead\n  }\n  throw e;\n}","preventionTips":["Build the files Map with basename-only keys (strip zip entry folder prefixes).","Key lookup is exact and case-sensitive — always insert metadata under the literal 'meta.json'.","If you already have parsed metadata, pass the SOGRootData object instead of a Map."],"tags":["sog","gaussian-splatting","input-validation","map-keys"],"backgroundTag":"required-file-missing","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}