stride3d/stride · error · Exception

Failed to get Vertex BufferData for entity

Error message

Failed to get Vertex BufferData for entity {chunk.Entity.Name}'s model.

What it means

Thrown by the prefab/model asset compiler when a mesh's vertex buffer reference cannot be loaded from the built asset data. The compiler looks up the vertex buffer's URL among the loaded assets and reads its serialized content; when the URL is missing or the buffer asset fails to load, vertexData stays null and this exception aborts the compilation of that entity's model.

Solutions

  1. Re-import the affected model asset from its original source file to regenerate buffer data
  2. Clean the asset output/cache directories and rebuild so all intermediate buffer assets are regenerated
  3. Open the prefab/model asset in Game Studio and verify mesh/buffer references are intact; fix broken references
  4. Check which entity the message names and inspect that model's source file for corruption
Defensive patterns

Strategy: validation

Validate before calling

// before compiling, ensure the vertex buffer reference is loadable
if (chunk.MeshDraw?.VertexBuffers == null || string.IsNullOrEmpty(vertexBufferRef?.Url))
    throw new InvalidOperationException($"Entity {chunk.Entity.Name} has no vertex buffer reference; re-import the model.");

Type guard

static bool HasBufferData(Buffer ref buffer) => buffer?.GetSerializationData()?.Content is { Length: > 0 };

Try / catch

try
{
    ProcessMaterial(chunk);
}
catch (Exception ex) when (ex.Message.Contains("Failed to get Vertex BufferData"))
{
    logger.Error($"Re-import model for entity '{chunk.Entity.Name}': {ex.Message}");
}

Prevention

When it happens

Trigger: ProcessMaterial encounters a mesh whose VertexBuffer reference has no valid URL/index into loaded assets, or manager.Load<Buffer>(vertexBufferRef.Url) returns an asset whose serialization content is unavailable.

Common situations: Corrupt or partially migrated model assets (fbx/3ds -> prefab), assets re-imported with a different Stride version so buffer URLs no longer match, deleting or renaming intermediate buffer assets, VCS merges losing asset references.

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/0e64b8754594094b. Report an issue: GitHub.

Appendix: source

Thrown at sources/engine/Stride.Assets.Models/PrefabModelAssetCompiler.cs:151

                                mesh = new MeshData { VertexStride = modelMesh.Draw.VertexBuffers[0].Stride };
                                meshes.Add(modelMesh.Draw.VertexBuffers[0].Declaration, mesh);
                            }

                            //vertexes
                            var vertexBufferRef = AttachedReferenceManager.GetAttachedReference(modelMesh.Draw.VertexBuffers[0].Buffer);
                            byte[] vertexData;
                            if (vertexBufferRef.Data != null)
                            {
                                vertexData = ((BufferData)vertexBufferRef.Data).Content;
                            }
                            else if (!string.IsNullOrEmpty(vertexBufferRef.Url))
                            {
                                var dataAsset = manager.Load<Buffer>(vertexBufferRef.Url);
                                vertexData = dataAsset.GetSerializationData().Content;
                            }
                            else
                            {
                                throw new Exception($"Failed to get Vertex BufferData for entity {chunk.Entity.Name}'s model.");
                            }

                            //transform the vertexes according to the entity
                            var vertexDataCopy = vertexData.ToArray();
                            chunk.Entity.Transform.UpdateWorldMatrix(); //make sure matrix is computed
                            var worldMatrix = chunk.Entity.Transform.WorldMatrix;
                            var up = Vector3.Cross(worldMatrix.Right, worldMatrix.Forward);
                            bool isScalingNegative = Vector3.Dot(worldMatrix.Up, up) < 0.0f;

                            modelMesh.Draw.VertexBuffers[0].TransformBuffer(vertexDataCopy, ref worldMatrix);

                            //add to the big single array
                            var vertexes = vertexDataCopy
                                .Skip(modelMesh.Draw.VertexBuffers[0].Offset)
                                .Take(modelMesh.Draw.VertexBuffers[0].Count*modelMesh.Draw.VertexBuffers[0].Stride)
                                .ToArray();

                            mesh.VertexData.AddRange(vertexes);

View on GitHub (pinned to 96fad776d2)