{"record":{"id":"71d413843147d9f8","repo":"bevyengine/bevy","slug":"vertex-attribute-0-must-not-be-empty","errorCode":null,"errorMessage":"Vertex attribute {0:?} must not be empty","messagePattern":"Vertex attribute (.+?) must not be empty","errorType":"validation","errorClass":"MeshAttributeCompressionError","httpStatus":null,"severity":"error","filePath":"crates/bevy_mesh/src/mesh.rs","lineNumber":3179,"sourceCode":"                            was not specified with `MeshDeserializer::add_custom_vertex_attribute`. Ignoring.\"\n                        );\n                        return None;\n                    };\n                    Some((id, data))\n                })\n                .collect()),\n            indices: serialized_mesh.indices.into(),\n            ..Mesh::new(serialized_mesh.primitive_topology, RenderAssetUsages::default())\n        }\n    }\n}\n\n/// Error that can occur when compressing/quantizing mesh vertex attributes.\n#[derive(Error, Debug, Clone)]\npub enum MeshAttributeCompressionError {\n    #[error(\"Vertex attribute {0:?} doesn't exist\")]\n    MissingAttribute(MeshVertexAttributeId),\n    #[error(\"Vertex attribute {0:?} must not be empty\")]\n    EmptyAttribute(MeshVertexAttribute),\n    #[error(\n        \"Vertex attribute {attr:?} must have format {expected:?} before compressing/quantizing\"\n    )]\n    UnsupportedAttributeForCompression {\n        attr: MeshVertexAttribute,\n        expected: VertexFormat,\n    },\n    #[error(\"Vertex attribute {attr:?} must have format `Float32`, `Float32x2` or `Float32x4` before quantizing\")]\n    UnsupportedAttributeForQuantizing { attr: MeshVertexAttribute },\n}\n\n/// Error that can occur when calling [`Mesh::merge_duplicate_vertices`]\n#[derive(Error, Debug, Clone)]\npub enum MeshMergeDuplicateVerticesError {\n    #[error(\"Index attribute already set.\")]\n    IndicesAlreadySet,\n    #[error(\"Mesh access error: {0}\")]","sourceCodeStart":3161,"sourceCodeEnd":3197,"githubUrl":"https://github.com/bevyengine/bevy/blob/8d743eb7dc7fcff57a7d5744d0bbf89620b1b145/crates/bevy_mesh/src/mesh.rs#L3161-L3197","documentation":"MeshAttributeCompressionError::EmptyAttribute is thrown when the vertex attribute targeted for compression/quantization exists in the mesh but has no vertex data (zero vertices or an empty buffer). The library refuses to compress an attribute it cannot read any values from.","triggerScenarios":"Calling Mesh::compress_attribute / quantize_attribute on a mesh whose attribute buffer is empty — e.g. a mesh created and insert_attribute called with no vertices, or all vertices removed before compression.","commonSituations":"Building a Mesh procedurally and compressing before populating vertices; a degenerate mesh with 0 vertices produced by upstream generation code; meshes whose attribute vectors were cleared by earlier processing.","solutions":["Populate the attribute's vertex data (set via insert_attribute or with the appropriate setter) before compressing","Check the attribute length before compressing: only call compress_attribute when mesh.attribute_len(id) > 0 (or attribute(id).count() > 0)","Skip compression for degenerate/empty meshes in your asset-processing pipeline"],"exampleFix":"// before\nmesh.quantize_attribute(Mesh::ATTRIBUTE_POSITION.id);\n// after\nif mesh.attribute_len(Mesh::ATTRIBUTE_POSITION.id) > 0 {\n    mesh.quantize_attribute(Mesh::ATTRIBUTE_POSITION.id);\n}","handlingStrategy":"validation","validationCode":"fn attr_non_empty(mesh: &Mesh, id: MeshVertexAttributeId) -> bool {\n    mesh.attribute(id).map(|a| a.count()) > Some(0)\n}","typeGuard":null,"tryCatchPattern":"match mesh.compress_attribute(id) {\n    Err(MeshAttributeCompressionError::EmptyAttribute(attr)) => {\n        info!(\"attribute {:?} empty; nothing to compress\", attr);\n    }\n    other => other.map(|_| ()),\n}","preventionTips":["Never compress meshes with 0 vertices; check vertex count first","Populate attribute buffers immediately after insert_attribute","Filter degenerate meshes out of asset processing early"],"tags":["bevy","mesh","vertex-attribute","compression","empty-data"],"backgroundTag":"empty-required-field","analyzedSha":"8d743eb7dc7fcff57a7d5744d0bbf89620b1b145","analyzedAt":"2026-09-13T03:07:18.343Z","contentChangedAt":"2026-09-13T03:07:18.343Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}