stride3d/stride · error · Exception

Failed to find index buffer while building a convex hull.

Error message

Failed to find index buffer while building a convex hull.

What it means

ColliderShapeAssetCompiler's convex hull builder requires a separate index buffer asset referenced by the mesh. When the index buffer URL cannot be loaded (assetManager.Load<Buffer> fails or the reference is absent), the compiler throws this Exception. The mesh data itself loaded, but the companion index buffer is missing.

Solutions

  1. Re-link the collider's mesh/index buffer reference in the editor so it points to an existing Buffer asset
  2. Re-import the source model so the index buffer asset is regenerated
  3. Check the referenced Url exists in the asset output and fix the broken reference
  4. Recreate the collider shape if the reference is stale

Example fix

// before: asset deleted, reference dangles
var shape = new ConvexHullColliderShapeDesc { IndexBuffer = deletedBufferRef };
// after: re-import model then reference the regenerated buffer
var shape = new ConvexHullColliderShapeDesc { IndexBuffer = reimportedIndexBufferRef };
Defensive patterns

Strategy: validation

Validate before calling

var url = convexHull.IndexBuffer?.Url;
if (string.IsNullOrEmpty(url) || !projectAssetExists(url))
    throw new InvalidOperationException($"Index buffer asset '{url}' referenced by convex hull is missing");

Prevention

When it happens

Trigger: A convex hull collider shape references a mesh whose IndexBuffer asset URL is null, was renamed, or was deleted from the asset project while building collider data in DoCommandOverride.

Common situations: Deleting or moving the buffer asset after setting up a convex hull collider, broken asset references after renaming in an IDE instead of the editor, or an asset import that never produced the index buffer.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at sources/engine/Stride.Assets/Physics/ColliderShapeAssetCompiler.cs:270

                                combinedVerts.Add(rotatedMatrix.TranslationVector.Z);

                                vertexIndex += stride;
                            }

                            var indexBufferRef = AttachedReferenceManager.GetAttachedReference(meshData.Draw.IndexBuffer.Buffer);
                            byte[] indexData;
                            if (indexBufferRef.Data != null)
                            {
                                indexData = ((BufferData)indexBufferRef.Data).Content;
                            }
                            else if (!string.IsNullOrEmpty(indexBufferRef.Url))
                            {
                                var dataAsset = assetManager.Load<Buffer>(indexBufferRef.Url);
                                indexData = dataAsset.GetSerializationData().Content;
                            }
                            else
                            {
                                throw new Exception("Failed to find index buffer while building a convex hull.");
                            }

                            var indexIndex = meshData.Draw.IndexBuffer.Offset;
                            for (var v = 0; v < meshData.Draw.IndexBuffer.Count; v++)
                            {
                                if (meshData.Draw.IndexBuffer.Is32Bit)
                                {
                                    combinedIndices.Add(BitConverter.ToUInt32(indexData, indexIndex) + indexOffset);
                                    indexIndex += 4;
                                }
                                else
                                {
                                    combinedIndices.Add(BitConverter.ToUInt16(indexData, indexIndex) + indexOffset);
                                    indexIndex += 2;
                                }
                            }
                        }

View on GitHub (pinned to 96fad776d2)