zed-industries/zed · error

could not parse YAML frontmatter

Error message

could not parse YAML frontmatter

What it means

In extract_frontmatter, none of the candidate `---` closers produced a SkillMetadata-deserializable YAML document; the last serde_yaml_ng error is retained, meaning the SKILL.md frontmatter is malformed.

Solutions

  1. Check the SKILL.md frontmatter delimiters: ensure the opening --- line is followed by valid YAML and a matching closing ---
  2. Escape or quote YAML special characters in frontmatter values
  3. Avoid quoted strings or block scalars in frontmatter that contain early --- terminator candidates
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/agent_skills/agent_skills.rs:411 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at crates/agent_skills/agent_skills.rs:412

    // terminator and ask `serde_yaml_ng` to parse it as a YAML stream. If the
    // first document deserializes into `SkillMetadata`, that candidate is the
    // real closer. Otherwise an earlier candidate may have cut the YAML in the
    // middle of a scalar / quoted string; try the next one.
    let mut last_error: Option<anyhow::Error> = None;
    for end in candidates {
        let prefix = &content[..end];
        let mut docs = serde_yaml_ng::Deserializer::from_str(prefix);
        let Some(first_doc) = docs.next() else {
            continue;
        };
        match SkillMetadata::deserialize(first_doc) {
            Ok(metadata) => return Ok((metadata, &content[end..])),
            Err(e) => last_error = Some(anyhow::Error::new(e)),
        }
    }

    Err(last_error
        .unwrap_or_else(|| anyhow::anyhow!("could not parse YAML frontmatter"))
        .context("Invalid YAML frontmatter"))
}

/// Maximum length for a valid skill name. Mirrors the upper bound enforced
/// by [`validate_name`].
pub const MAX_SKILL_NAME_LEN: usize = 64;

/// Maximum recommended length (in Unicode scalar values) for a skill description. The
/// create-skill UI enforces this as a hard limit, while the loader emits a
/// warning and still loads longer descriptions.
pub const MAX_SKILL_DESCRIPTION_LEN: usize = 1024;

/// Convert an arbitrary human-readable string into a valid skill name, or
/// return `None` if no valid name can be produced (e.g. the input contains
/// no ASCII alphanumeric characters at all).
///
/// The transformation:
///

View on GitHub (pinned to 9d272b0363)