{"record":{"id":"c932c17a9d91a0a0","repo":"BabylonJS/Babylon.js","slug":"unable-to-generate-navmesh-tilecache-e","errorCode":null,"errorMessage":"Unable to generate navMesh/tileCache: ${e}","messagePattern":"Unable to generate navMesh/tileCache: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/addons/src/navigation/generator/generator.worker.ts","lineNumber":66,"sourceCode":"        } else {\n            const { navMesh, tileCache } = e.data;\n            if (tileCache) {\n                // if tileCache is present, the binary data contains the navmesh and the tilecache as well\n                const tileCacheArray = new Uint8Array(tileCache);\n                const navMeshData = BuildFromTileCacheData(tileCacheArray, CreateDefaultTileCacheMeshProcess());\n                workerOptions.completion(navMeshData.navMesh, navMeshData.navMeshQuery, navMeshData.tileCache);\n                return;\n            } else {\n                if (navMesh) {\n                    // deserialize the navmesh only (no tilecache present)\n                    const navMeshArray = new Uint8Array(navMesh);\n                    const navMeshData = BuildFromNavmeshData(navMeshArray);\n                    workerOptions.completion(navMeshData.navMesh, navMeshData.navMeshQuery, undefined);\n                    return;\n                }\n            }\n\n            throw new Error(`Unable to generate navMesh/tileCache: ${e}`);\n        }\n    };\n\n    // send message to worker\n    const [positions, indices] = GetPositionsAndIndices(meshes, { doNotReverseIndices: parameters.doNotReverseIndices });\n    const positionsCopy = new Float32Array(positions);\n    const indicesCopy = new Uint32Array(indices);\n    workerOptions.worker.postMessage({ positions: positionsCopy, indices: indicesCopy, parameters }, [positionsCopy.buffer, indicesCopy.buffer]);\n}\n","sourceCodeStart":48,"sourceCodeEnd":76,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/addons/src/navigation/generator/generator.worker.ts#L48-L76","documentation":"This error is thrown inside the onmessage handler of GenerateNavMeshWithWorker (generator.worker.ts:66) when a message arrives from the navmesh Web Worker that is neither a success:false failure nor carries usable navMesh (or tileCache) binary data. In other words, the worker replied, but its payload contained no deserializable navmesh/tilecache bytes, so the plugin cannot build a NavMesh. It is the 'silent empty response' branch of worker-based navmesh generation in Babylon.js's recast-navigation-js wrapper.","triggerScenarios":"Calling plugin.createNavMeshAsync on a plugin created via CreateNavigationPluginWorkerAsync when the worker posts a message whose data lacks both a truthy navMesh field and a truthy tileCache field (and is not marked success:false). This happens when generation produced no output — e.g. the worker-side generator threw before serializing, the posted parameters yielded an empty navmesh, or the blob-worker (built from GenerateNavMeshWorker.toString()) failed to load the wasm module and returned an incomplete payload.","commonSituations":"Using the experimental worker factory (workers are explicitly 'not yet supported' per the file header), generating a navmesh from meshes whose geometry produces zero walkable area (wrong axis/winding, no geometry within the tile bounds), wasm assets not bundled/reachable from the blob worker, or misconfigured INavMeshParametersV2 (tileSize/cellSize) yielding empty tiles.","solutions":["Use the supported single-threaded path instead: create the plugin with CreateNavigationPluginAsync() and call createNavMeshAsync — worker-based generation is documented as not yet supported.","Log/inspect the raw worker message (e.data) to see what the worker actually returned; check the worker-side generator for errors swallowed before posting.","Verify the meshes passed to createNavMeshAsync have valid, walkable geometry (non-empty vertex/index buffers, correct winding; try doNotReverseIndices) and sensible parameters (cellSize, tileSize, agent radius/height).","Ensure @recast-navigation wasm files are correctly served/bundled so the blob worker can initialize recast before generating.","Wait for the completion callback (the promise from createNavMeshAsync) and guard against generating on an empty or partially loaded scene."],"exampleFix":"// before (worker plugin, experimental)\nconst plugin = await CreateNavigationPluginWorkerAsync();\nawait plugin.createNavMeshAsync(meshes, params);\n\n// after (supported single-threaded path)\nconst plugin = await CreateNavigationPluginAsync();\nawait plugin.createNavMeshAsync(meshes, params);","handlingStrategy":"try-catch","validationCode":"// Before using the worker plugin\nif (typeof window === \"undefined\" || !window.Worker) {\n    // fall back to single-threaded factory\n}\nif (meshes.length === 0 || meshes.every(m => !m.geometry || m.getTotalVertices() === 0)) {\n    throw new Error(\"No geometry provided for navmesh generation\");\n}","typeGuard":"function hasNavMeshPayload(data: unknown): data is { navMesh: ArrayBuffer | Uint8Array } {\n    return !!data && typeof data === \"object\" && \"navMesh\" in data && (data as any).navMesh != null;\n}","tryCatchPattern":"try {\n    const { navMesh } = await plugin.createNavMeshAsync(meshes, params);\n} catch (e) {\n    if (String(e).includes(\"Unable to generate navMesh/tileCache\")) {\n        // worker returned no data: fall back to single-threaded generation\n        const plugin2 = await CreateNavigationPluginAsync();\n        await plugin2.createNavMeshAsync(meshes, params);\n    } else { throw e; }\n}","preventionTips":["Prefer CreateNavigationPluginAsync (single-threaded) — worker generation is documented as not yet supported.","Always await createNavMeshAsync and handle rejection instead of relying on the worker callback.","Validate meshes have non-empty geometry and sane INavMeshParametersV2 (cellSize, tileSize, agent radius) before generating.","Ensure wasm assets for @recast-navigation are served and reachable from blob workers.","Inspect raw worker messages during development to catch empty payloads early."],"tags":["webworker","navigation","navmesh","async","recast"],"backgroundTag":"worker-response-missing-navmesh-data","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}