{"record":{"id":"46672a186e152ab1","repo":"stride3d/stride","slug":"failed-to-find-index-buffer-while-building-a-convex-hull","errorCode":null,"errorMessage":"Failed to find index buffer while building a convex hull.","messagePattern":"Failed to find index buffer while building a convex hull\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"sources/engine/Stride.Assets/BepuPhysics/HullAssetCompiler.cs","lineNumber":206,"sourceCode":"                            combinedVerts.Add(rotatedMatrix.TranslationVector.Z);\n\n                            vertexIndex += stride;\n                        }\n\n                        var indexBufferRef = AttachedReferenceManager.GetAttachedReference(meshData.Draw.IndexBuffer.Buffer);\n                        byte[] indexData;\n                        if (indexBufferRef.Data != null)\n                        {\n                            indexData = ((BufferData)indexBufferRef.Data).Content;\n                        }\n                        else if (!string.IsNullOrEmpty(indexBufferRef.Url))\n                        {\n                            var dataAsset = assetManager.Load<Buffer>(indexBufferRef.Url);\n                            indexData = dataAsset.GetSerializationData().Content;\n                        }\n                        else\n                        {\n                            throw new Exception(\"Failed to find index buffer while building a convex hull.\");\n                        }\n\n                        var indexIndex = meshData.Draw.IndexBuffer.Offset;\n                        for (var v = 0; v < meshData.Draw.IndexBuffer.Count; v++)\n                        {\n                            if (meshData.Draw.IndexBuffer.Is32Bit)\n                            {\n                                combinedIndices.Add(BitConverter.ToUInt32(indexData, indexIndex) + indexOffset);\n                                indexIndex += 4;\n                            }\n                            else\n                            {\n                                combinedIndices.Add(BitConverter.ToUInt16(indexData, indexIndex) + indexOffset);\n                                indexIndex += 2;\n                            }\n                        }\n                    }\n","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/engine/Stride.Assets/BepuPhysics/HullAssetCompiler.cs#L188-L224","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Re-import the source model so its index buffers are regenerated","Clean asset cache and rebuild the project","Regenerate the convex hull collider from the model in Game Studio","Verify the mesh actually contains indexed geometry (non-indexed/corrupt meshes cannot be used)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (meshData.Draw?.IndexBuffer == null || string.IsNullOrEmpty(indexBufferRef?.Url))\n    throw new InvalidOperationException(\"Mesh assigned to the convex hull has no loadable index buffer; re-import the source model.\");","typeGuard":"static bool HasLoadableIndexBuffer(Buffer ref indexBufferRef) => indexBufferRef?.Url is { Length: > 0 };","tryCatchPattern":"try\n{\n    BuildConvexHull(meshData);\n}\ncatch (Exception ex) when (ex.Message.Contains(\"Failed to find index buffer while building a convex hull\"))\n{\n    logger.Error(\"Re-import the model or regenerate the hull collider: \" + ex.Message);\n}","preventionTips":["Ensure collider source meshes are properly indexed geometry","Regenerate hull colliders after re-importing models","Clean asset cache after engine upgrades","Validate model assets load before attaching physics colliders"],"tags":["physics","convex-hull","assets"],"backgroundTag":"resource-not-found","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}