{"record":{"id":"bdb5c563068ca709","repo":"BabylonJS/Babylon.js","slug":"unable-to-create-navmesh-no-navmesh-or-navmeshque","errorCode":null,"errorMessage":"Unable to create navmesh. No navMesh or navMeshQuery returned.","messagePattern":"Unable to create navmesh\\. No navMesh or navMeshQuery returned\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/addons/src/navigation/plugin/RecastNavigationJSPlugin.ts","lineNumber":714,"sourceCode":"            options\n        );\n        const polyHeightResult = this._navMeshQuery.getPolyHeight(polyRef, resultPosition);\n\n        return {\n            position: { x: resultPosition.x, y: polyHeightResult.success ? polyHeightResult.height : resultPosition.y, z: resultPosition.z },\n            polyRef: polyRef,\n            height: polyHeightResult.height,\n        };\n    }\n\n    /**\n     * Handles common post-processing and validation of navmesh creation results\n     * @param result The partial result from navmesh creation\n     * @returns The validated and complete CreateNavMeshresult\n     */\n    private _processNavMeshResult(result: Nullable<Partial<CreateNavMeshResult>>): CreateNavMeshResult {\n        if (!result?.navMesh || !result?.navMeshQuery) {\n            throw new Error(\"Unable to create navmesh. No navMesh or navMeshQuery returned.\");\n        }\n\n        this.navMesh = result.navMesh;\n        this._navMeshQuery = result.navMeshQuery;\n        this._intermediates = result.intermediates;\n        this._tileCache = result.tileCache;\n\n        return {\n            navMesh: result.navMesh,\n            navMeshQuery: result.navMeshQuery,\n            intermediates: result.intermediates,\n            tileCache: result.tileCache, // tileCache is optional\n        };\n    }\n\n    private _preprocessParameters(parameters: INavMeshParametersV2) {\n        // if maxObstacles is not defined, set it to a default value and set a default tile size if not defined\n        if (parameters.maxObstacles === undefined) {","sourceCodeStart":696,"sourceCodeEnd":732,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/addons/src/navigation/plugin/RecastNavigationJSPlugin.ts#L696-L732","documentation":"_processNavMeshResult validates the result of Recast navmesh creation in createNavMesh/createNavMeshAsync. If the native/JS Recast call returns a partial result missing navMesh or navMeshQuery, the plugin throws instead of storing an unusable state.","triggerScenarios":"createNavMesh/createNavMeshAsync invoked with parameters or geometry from which Recast cannot build a navmesh (empty meshes, degenerate cell sizes, bad bmax/bmin), or a Recast library failure/limit returning null results.","commonSituations":"Passing an empty mesh array; navmesh parameters (cellSize, agentHeight, tile size) out of valid ranges; unsupported/incompatible recast wasm build returning null; geometry outside the computed bounds.","solutions":["Verify the meshes passed to createNavMesh are non-empty and visible/static","Review navmesh creation parameters (cellSize, cellHeight, agentRadius, tileSize) for valid values","Check the Recast library loaded correctly (plugin.isSupported / wasm initialized)","Wrap creation in try/catch and log parameters; reduce scene to a simple box to isolate the failing input"],"exampleFix":"// before\nconst result = await plugin.createNavMeshAsync([], params); // throws\n// after\nif (meshes.length === 0) {\n    throw new Error(\"No meshes provided for navmesh creation\");\n}\nconst result = await plugin.createNavMeshAsync(meshes, params);","handlingStrategy":"validation","validationCode":"if (meshes.length === 0) {\n    throw new Error(\"createNavMesh requires at least one mesh\");\n}\n// validate parameters\nif (!params.cellSize || params.cellSize <= 0) {\n    throw new Error(\"Invalid cellSize\");\n}\nconst result = await plugin.createNavMeshAsync(meshes, params);","typeGuard":"const isValidResult = (r: unknown): r is { navMesh: object; navMeshQuery: object } =>\n    !!r && typeof r === 'object' && 'navMesh' in r && 'navMeshQuery' in r &&\n    (r as any).navMesh != null && (r as any).navMeshQuery != null;","tryCatchPattern":"try {\n    const result = await plugin.createNavMeshAsync(meshes, params);\n} catch (e) {\n    if (e.message.includes(\"Unable to create navmesh\")) {\n        console.error(\"Navmesh params:\", params, \"meshes:\", meshes.length);\n        // retry with simplified geometry / default params\n        await plugin.createNavMeshAsync(meshes, defaultParams);\n    }\n}","preventionTips":["Validate creation parameters against documented ranges before calling","Test with a simple box mesh to isolate bad geometry or params","Confirm the Recast wasm library initialized (plugin.isSupported) before building"],"tags":["navigation","recast","navmesh","validation"],"backgroundTag":"navmesh-build-failed","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}