zed-industries/zed · error

Failed to deserialize metadata

Error message

Failed to deserialize metadata

What it means

Panics in handle_postprocessing while scanning built `.html` files when a page's ZED_META front-matter comment cannot be deserialized into the metadata struct — usually malformed or hand-edited front matter in a docs page.

Source

Thrown at crates/docs_preprocessor/src/main.rs:779

                if ignore_list.contains(&&*entry.file_name().to_string_lossy()) {
                    zlog::info!(logger => "Ignoring {}", entry.path().to_string_lossy());
                } else {
                    files.push(entry.path());
                }
            }
        }
    }

    zlog::info!(logger => "Processing {} `.html` files", files.len());
    let pages = docs_pages(&ctx.book)?;
    write_ai_discovery_artifacts(&pages, &root_dir, &site_url)?;
    let meta_regex = Regex::new(&FRONT_MATTER_COMMENT.replace("{}", "(.*)")).unwrap();
    for file in &files {
        let contents = std::fs::read_to_string(&file)?;
        let mut meta_description = None;
        let mut meta_title = None;
        let contents = meta_regex.replace(&contents, |caps: &regex::Captures| {
            let metadata: HashMap<String, String> = serde_json::from_str(&caps[1]).with_context(|| format!("JSON Metadata: {:?}", &caps[1])).expect("Failed to deserialize metadata");
            for (kind, content) in metadata {
                match kind.as_str() {
                    "description" => {
                        meta_description = Some(content);
                    }
                    "title" => {
                        meta_title = Some(content);
                    }
                    _ => {
                        zlog::warn!(logger => "Unrecognized frontmatter key: {} in {:?}", kind, pretty_path(&file, &root_dir));
                    }
                }
            }
            String::new()
        });
        let meta_description = meta_description.as_ref().unwrap_or_else(|| {
            zlog::warn!(logger => "No meta description found for {:?}", pretty_path(&file, &root_dir));
            &default_description

View on GitHub (pinned to f4178619ac)

Solutions

  1. Fix the ZED_META JSON comment in the offending generated page source
  2. Regenerate the page from its markdown source rather than editing HTML directly
  3. Check the front-matter schema for newly added/renamed fields
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/docs_preprocessor/src/main.rs:779 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/f047078303127af4. Report an issue: GitHub.