BabylonJS/Babylon.js · error · Error

meta.json not found in files Map

Error message

meta.json not found in files Map

What it means

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.

Source

Thrown at packages/dev/loaders/src/SPLAT/sog.pure.ts:389

}

/**
 * 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)
 * @param dataOrFiles Either the SOGRootData or a Map of filenames to Uint8Array file data (including meta.json)
 * @param rootUrl Base URL to load webp files from (if dataOrFiles is SOGRootData)
 * @param scene The Babylon.js scene
 * @returns Parsed data
 */
export async function ParseSogMeta(dataOrFiles: SOGRootData | Map<string, Uint8Array>, rootUrl: string, scene: Scene): Promise<IParsedSplat> {
    let data: SOGRootData;
    let files: Map<string, Uint8Array> | undefined;

    if (dataOrFiles instanceof Map) {
        files = dataOrFiles;

        const metaFile = files.get("meta.json");
        if (!metaFile) {
            throw new Error("meta.json not found in files Map");
        }

        data = JSON.parse(new TextDecoder().decode(metaFile)) as SOGRootData;
    } else {
        data = dataOrFiles;
    }

    // Collect all file names
    const urls = [...data.means.files, ...data.scales.files, ...data.quats.files, ...data.sh0.files];
    if (data.shN) {
        urls.push(...data.shN.files);
    }

    // Load webp images in parallel
    const imageDataArrays: IWebPImage[] = await Promise.all(
        urls.map(async (fileName) => {
            if (files && files.has(fileName)) {
                // load from in-memory Uint8Array

View on GitHub (pinned to 0592b347b8)

Solutions

  1. Ensure the Map contains the exact key "meta.json" (lowercase, no path prefix).
  2. 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".
  3. Alternatively parse meta.json yourself and pass the resulting SOGRootData object to ParseSogMeta instead of the Map.

Example fix

// before
const files = new Map(entries.map((e) => [e.name, e.data])); // keys like "bundle/meta.json"
// after
const files = new Map(entries.map((e) => [e.name.split("/").pop()!, e.data]));
if (!files.has("meta.json")) throw new Error("meta.json missing after normalization");
Defensive patterns

Strategy: type-guard

Validate before calling

function requireMetaJson(files) {
  const meta = files.get('meta.json');
  if (!meta) {
    const keys = [...files.keys()].join(', ');
    throw new Error(`meta.json missing from files Map (keys: ${keys})`);
  }
  return meta;
}

Type guard

function hasMetaJson(files) {
  return files instanceof Map && files.has('meta.json');
}

Try / catch

try {
  return await ParseSogMeta(filesMap, rootUrl, scene);
} catch (e) {
  if (e.message.includes('meta.json not found')) {
    // normalize keys (strip paths, fix case) and retry once, or pass parsed SOGRootData instead
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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).

Related errors


AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30). Data as JSON: /api/errors/a9e75870acc009a1. Report an issue: GitHub.