stride3d/stride · error · InvalidOperationException

Failed to add tile

Error message

Failed to add tile

What it means

Thrown in NavigationProcessor.Load when RecastNavigationMesh.AddOrReplaceTile returns false while inserting the initial tiles of a loaded navigation mesh group, meaning Recast's tile cache rejected the tile data (e.g. incompatible tile build parameters or corrupt tile data).

Solutions

  1. Rebuild/rebake the navigation mesh asset with the current project settings
  2. Verify navmesh build settings (tile size, cell size, agent config) were not changed after baking
  3. Check tile data integrity; re-export or regenerate the group data
Defensive patterns

Strategy: try-catch

Try / catch

try { navmesh.AddOrReplaceTile(tile.Data); }
catch (InvalidOperationException) { /* rebake navmesh asset or skip stale tile */ }

Prevention

When it happens

Trigger: Loading a prebuilt navigation mesh asset whose tiles were baked with settings (cell size, tile size, agent parameters) inconsistent with the runtime navmesh instance, or corrupted/empty tile data.

Common situations: Version mismatches between editor-generated navmesh assets and the runtime build, changing NavMesh settings after baking, or asset corruption.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14). Data as JSON: /api/errors/9c2e87db6f751364. Report an issue: GitHub.

Appendix: source

Thrown at sources/engine/Stride.Navigation/Processors/NavigationProcessor.cs:232

            }

            if (!data.LoadedGroups.TryGetValue(groupId, out var groupData))
            {
                if (!mesh.Layers.TryGetValue(groupId, out var layer))
                    return null; // Group not present in navigation mesh

                data.LoadedGroups.Add(groupId, groupData = new NavigationMeshGroupData
                {
                    Data = data,
                    RecastNavigationMesh = new RecastNavigationMesh(mesh),
                    Id = groupId,
                });

                // Add initial tiles to the navigation mesh
                foreach (var tile in layer.Tiles)
                {
                    if (!groupData.RecastNavigationMesh.AddOrReplaceTile(tile.Value.Data))
                        throw new InvalidOperationException("Failed to add tile");
                }
            }

            groupData.AddReference();
            return groupData;
        }

        /// <summary>
        /// Removes a reference to a group
        /// </summary>
        private void Unload(NavigationMeshGroupData group)
        {
            int referenceCount = group.Release();
            if (referenceCount < 0)
                throw new ArgumentOutOfRangeException();

            if (referenceCount == 0)
            {

View on GitHub (pinned to 96fad776d2)