{"record":{"id":"afe4370a227dee6a","repo":"bevyengine/bevy","slug":"vertex-attribute-attr-must-have-format-float32-float32x2-or","errorCode":null,"errorMessage":"Vertex attribute {attr:?} must have format `Float32`, `Float32x2` or `Float32x4` before quantizing","messagePattern":"Vertex attribute (.+?) must have format `Float32`, `Float32x2` or `Float32x4` before quantizing","errorType":"validation","errorClass":"MeshAttributeCompressionError","httpStatus":null,"severity":"error","filePath":"crates/bevy_mesh/src/mesh.rs","lineNumber":3188,"sourceCode":"        }\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}\")]\n    MeshAccessError(#[from] MeshAccessError),\n}\n\n/// Error that can occur when calling [`Mesh::merge`].\n#[derive(Error, Debug, Clone)]\npub enum MeshMergeError {\n    #[error(\"Incompatible vertex attribute types: {} and {}\", self_attribute.name, other_attribute.map(|a| a.name).unwrap_or(\"None\"))]\n    IncompatibleVertexAttributes {\n        self_attribute: MeshVertexAttribute,","sourceCodeStart":3170,"sourceCodeEnd":3206,"githubUrl":"https://github.com/bevyengine/bevy/blob/8d743eb7dc7fcff57a7d5744d0bbf89620b1b145/crates/bevy_mesh/src/mesh.rs#L3170-L3206","documentation":"MeshAttributeCompressionError::UnsupportedAttributeForQuantizing is thrown when quantizing an attribute whose VertexFormat is not Float32, Float32x2, or Float32x4. Quantization operates on raw floating-point components, so the library requires one of these three source formats.","triggerScenarios":"Calling Mesh::quantize_attribute on an attribute stored in any format other than Float32/Float32x2/Float32x4 — e.g. already-quantized Snorm/Unorm formats, integer formats, or a half-float format.","commonSituations":"Quantizing an attribute that was already quantized in a previous processing pass; meshes imported with normalized integer vertex formats from glTF/FBX; hand-built meshes inserted with the wrong VertexFormat.","solutions":["Ensure the attribute is in a Float32, Float32x2, or Float32x4 format (convert first if needed) before calling quantize_attribute","Check the format before quantizing: mesh.attribute(id).map(|a| a.format()) and only quantize when it matches","Do not quantize attributes that are already in a compressed/normalized format — skip them in your pipeline","Fix the insert_attribute call to use the intended float VertexFormat when constructing the mesh"],"exampleFix":"// before\nmesh.quantize_attribute(attr_id); // attr format is Float32x3\n// after\nlet fmt = mesh.attribute(attr_id).map(|a| a.format());\nif matches!(fmt, Some(VertexFormat::Float32 | VertexFormat::Float32x2 | VertexFormat::Float32x4)) {\n    mesh.quantize_attribute(attr_id);\n}","handlingStrategy":"validation","validationCode":"fn quantizable(mesh: &Mesh, id: MeshVertexAttributeId) -> bool {\n    matches!(\n        mesh.attribute(id).map(|a| a.format()),\n        Some(VertexFormat::Float32 | VertexFormat::Float32x2 | VertexFormat::Float32x4)\n    )\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(MeshAttributeCompressionError::UnsupportedAttributeForQuantizing { attr }) => {\n        warn!(\"{:?} not float32*; skipping quantize\", attr);\n    }\n    _ => {}\n}","preventionTips":["Only quantize once, from Float32 source formats","Check attribute format before every quantize call","Handle imported meshes whose formats are normalized integers by converting first"],"tags":["bevy","mesh","vertex-format","quantization"],"backgroundTag":"unsupported-dtype","analyzedSha":"8d743eb7dc7fcff57a7d5744d0bbf89620b1b145","analyzedAt":"2026-09-13T03:07:18.343Z","contentChangedAt":"2026-09-13T03:07:18.343Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}