{"record":{"id":"600b741ad63c013c","repo":"bevyengine/bevy","slug":"failed-to-generate-morph-targets-0","errorCode":null,"errorMessage":"failed to generate morph targets: {0}","messagePattern":"failed to generate morph targets: (.+?)","errorType":"exception","errorClass":"GltfError","httpStatus":null,"severity":"error","filePath":"crates/bevy_gltf/src/loader/mod.rs","lineNumber":131,"sourceCode":"    ImageError(#[from] TextureError),\n    /// The image URI was unable to be resolved with respect to the asset path.\n    #[error(\"invalid image uri: {0}. asset path error={1}\")]\n    InvalidImageUri(String, ParseAssetPathError),\n    /// Failed to read bytes from an asset path.\n    #[error(\"failed to read bytes from an asset path: {0}\")]\n    ReadAssetBytesError(#[from] ReadAssetBytesError),\n    /// Failed to load asset from an asset path.\n    #[error(\"failed to load asset from an asset path: {0}\")]\n    AssetLoadError(#[from] AssetLoadError),\n    /// Missing sampler for an animation.\n    #[error(\"Missing sampler for animation {0}\")]\n    #[from(ignore)]\n    MissingAnimationSampler(usize),\n    /// Failed to generate tangents.\n    #[error(\"failed to generate tangents: {0}\")]\n    GenerateTangentsError(#[from] bevy_mesh::GenerateTangentsError),\n    /// Failed to generate morph targets.\n    #[error(\"failed to generate morph targets: {0}\")]\n    MorphTarget(#[from] bevy_mesh::morph::MorphBuildError),\n    /// Circular children in Nodes\n    #[error(\"GLTF model must be a tree, found cycle instead at node indices: {0:?}\")]\n    #[from(ignore)]\n    CircularChildren(String),\n    /// Failed to load a file.\n    #[error(\"failed to load file: {0}\")]\n    Io(#[from] Error),\n}\n\n/// Loads glTF files with all of their data as their corresponding bevy representations.\n#[derive(TypePath)]\npub struct GltfLoader {\n    /// List of compressed image formats handled by the loader.\n    pub supported_compressed_formats: CompressedImageFormats,\n    /// Custom vertex attributes that will be recognized when loading a glTF file.\n    ///\n    /// Keys must be the attribute names as found in the glTF data, which must start with an underscore.","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_gltf/src/loader/mod.rs#L113-L149","documentation":"GltfError::MorphTarget (#[from] bevy_mesh::morph::MorphBuildError) wraps failures while building morph-target vertex data and weights: mesh.set_morph_targets (loader/mod.rs:810) and MorphWeights::new (mod.rs:1902) require each target's attributes to match the expected POSITION/NORMAL/TANGENT layout and consistent counts; mismatches error out instead of producing a broken skinned mesh.","triggerScenarios":"A primitive whose morph targets omit some attributes (e.g. targets with POSITION but stray formats), target attributes with differing vertex counts/formats, or weights arrays inconsistent with the number of targets.","commonSituations":"Shape keys exported partially from DCCs; hand-crafted morph data; mixers combining targets from different meshes; aggressive optimizers rewriting morph accessors.","solutions":["Re-export shape keys ensuring every target carries POSITION (+ NORMAL/TANGENT) with identical formats and counts.","Delete unused shape keys before export to shrink the surface for mistakes.","Validate morph accessors with gltf-validator (checks target attribute consistency).","If morphs are not needed, export without shape keys."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"fn morph_targets_consistent(doc: &gltf::Document) -> bool {\n    doc.meshes().flat_map(|m| m.primitives()).all(|p| {\n        let base: Vec<_> = p.attributes().iter().map(|(s, _)| s.to_string()).collect();\n        p.morph_targets().all(|t| t.iter().all(|(s, _)| {\n            base.iter().any(|b| b == &s.to_string())\n                && matches!(s, gltf::Semantic::Positions | gltf::Semantic::Normals | gltf::Semantic::Tangents)\n        }))\n    })\n}","typeGuard":null,"tryCatchPattern":"match err {\n    GltfError::MorphTarget(e) => {\n        warn!(\"morph targets invalid ({e:?}); re-export shape keys with full POSITION/NORMAL/TANGENT sets\");\n    }\n    other => return Err(other.into()),\n}","preventionTips":["Delete unused shape keys before export.","Keep target attribute formats identical to the base mesh.","Run gltf-validator on morph-heavy assets."],"tags":["gltf","morph-targets","shape-keys","mesh","bevy"],"backgroundTag":"morph-target-build-failed","analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}