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

Thrown by the BepuPhysics hull asset compiler when the mesh used to build a convex hull has no loadable index buffer. The compiler needs index data to iterate triangles for hull computation; if the reference is missing or the buffer asset can't be loaded, compilation of the convex hull asset fails.

Solutions

  1. Re-import the source model so its index buffers are regenerated
  2. Clean asset cache and rebuild the project
  3. Regenerate the convex hull collider from the model in Game Studio
  4. Verify the mesh actually contains indexed geometry (non-indexed/corrupt meshes cannot be used)
Defensive patterns

Strategy: validation

Validate before calling

if (meshData.Draw?.IndexBuffer == null || string.IsNullOrEmpty(indexBufferRef?.Url))
    throw new InvalidOperationException("Mesh assigned to the convex hull has no loadable index buffer; re-import the source model.");

Type guard

static bool HasLoadableIndexBuffer(Buffer ref indexBufferRef) => indexBufferRef?.Url is { Length: > 0 };

Try / catch

try
{
    BuildConvexHull(meshData);
}
catch (Exception ex) when (ex.Message.Contains("Failed to find index buffer while building a convex hull"))
{
    logger.Error("Re-import the model or regenerate the hull collider: " + ex.Message);
}

Prevention

When it happens

Trigger: DoCommandOverride processes a collider/mesh hull where meshData's IndexBuffer reference URL is absent, or assetManager.Load<Buffer>(indexBufferRef.Url) returns an asset without serialization content.

Common situations: Convex hull collider generated from a model whose mesh lacks index data, stale intermediate assets after engine upgrade, corrupt imported meshes assigned to physics colliders.

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/46672a186e152ab1. Report an issue: GitHub.

Appendix: source

Thrown at sources/engine/Stride.Assets/BepuPhysics/HullAssetCompiler.cs:206

                            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)