zed-industries/zed · error · anyhow::Error

SKILL.md must start with YAML frontmatter (---)

Error message

SKILL.md must start with YAML frontmatter (---)

What it means

Error "SKILL.md must start with YAML frontmatter (---)" thrown in zed-industries/zed.

Source

Thrown at crates/agent_skills/agent_skills.rs:347

        return Err("Skill description cannot be empty");
    }

    let mut warnings = Vec::new();
    if description.len() > MAX_SKILL_DESCRIPTION_LEN {
        warnings.push(SkillLoadWarning::DescriptionTooLong {
            actual_len: description.len(),
            max_len: MAX_SKILL_DESCRIPTION_LEN,
        });
    }

    Ok(warnings)
}

fn extract_frontmatter(content: &str) -> Result<(SkillMetadata, &str)> {
    let content = content.trim_start();

    if !content.starts_with("---") {
        anyhow::bail!("SKILL.md must start with YAML frontmatter (---)");
    }

    // Find every candidate closing `---` line: a line consisting EXACTLY of
    // `---` (followed by `\n`, `\r\n`, or EOF) at column 0, excluding the
    // opening line itself. The opener occupies bytes 0..(first line ending),
    // and our scan starts after each `\n`, so the opener is naturally skipped.
    //
    // For each candidate we record the byte position right after its line
    // ending; that's both where the YAML stream slice ends and where the body
    // begins.
    let bytes = content.as_bytes();
    let mut candidates: Vec<usize> = Vec::new();
    for (i, &b) in bytes.iter().enumerate() {
        if b != b'\n' {
            continue;
        }
        let line_start = i + 1;
        if line_start + 3 > bytes.len() {

View on GitHub (pinned to bc538def45)

When it happens

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

Common situations: See trigger scenarios.


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