FyroxEngine/Fyrox · warning

glTF: Unable to extract blend shape names from JSON

Error message

glTF: Unable to extract blend shape names from JSON: {}

What it means

glTF import reads blend shape (morph target) names from the mesh extras JSON. If extras exist but no names could be parsed out of the JSON, the importer warns with the raw JSON content and returns an empty name list, so blend shapes will have no names.

Solutions

  1. Ensure mesh extras contain a valid targetNames array of strings (e.g. {"targetNames":["smile","frown"]})
  2. Re-export the glTF from a tool that writes standard morph target names
  3. Fix or remove the malformed extras JSON in the .gltf/.glb

Example fix

// before (glTF extras)
"extras": { "targetnames": "smile frown" }
// after
"extras": { "targetNames": ["smile", "frown"] }
Defensive patterns

Strategy: validation

Validate before calling

// validate extras JSON before import
if let Some(extras) = &mesh.extras {
    let names: Option<Vec<String>> = serde_json::from_str::<serde_json::Value>(extras.get())
        .ok().and_then(|v| v.get("targetNames").and_then(|n| serde_json::from_value(n.clone()).ok()));
    if extras.get() != "null" && names.map_or(true, |n| n.is_empty()) {
        eprintln!("glTF extras lacks valid targetNames: {}", extras.get());
    }
}

Prevention

When it happens

Trigger: import_morph_info encountering a glTF mesh whose extras contain blend shape data (e.g. targetNames) but in a malformed or unexpected JSON shape so the names array comes back empty.

Common situations: Exporter writing targetNames in a non-standard location or format (e.g. not a JSON string array); hand-edited glTF files; tools emitting extras the importer doesn't recognize.

Understand the failure class

Background: JSON parse error: "Unexpected token" / "not valid JSON" / "failed to parse" — what JSON parsers are really complaining about — this error's family across 45 libraries.

Related errors


AI-assisted analysis of FyroxEngine/Fyrox@76c91aad8e (2026-09-10). Data as JSON: /api/errors/a0f2619078acac89. Report an issue: GitHub.

Appendix: source

Thrown at fyrox-impl/src/resource/gltf/mod.rs:539

            json::Value::Object(map) => {
                if let Some(names) = map.get(TARGET_NAMES_KEY) {
                    match names {
                        json::Value::Array(names) => {
                            values_to_strings(names.as_slice()).unwrap_or_default()
                        }
                        _ => Vec::default(),
                    }
                } else {
                    Vec::default()
                }
            }
            _ => Vec::default(),
        }
    } else {
        Vec::default()
    };
    if extras.is_some() && names.is_empty() {
        Log::warn(format!(
            "glTF: Unable to extract blend shape names from JSON: {}",
            extras.as_ref().unwrap().get()
        ));
    }
    Ok(BlendShapeInfoContainer::new(names, weights))
}

fn values_to_strings(values: &[json::Value]) -> Option<Vec<String>> {
    let mut result: Vec<String> = Vec::with_capacity(values.len());
    for v in values {
        if let json::Value::String(str) = v {
            result.push(str.clone());
        } else {
            return None;
        }
    }
    Some(result)
}

View on GitHub (pinned to 76c91aad8e)