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

SKILL.md missing closing frontmatter delimiter (---)

Error message

SKILL.md missing closing frontmatter delimiter (---)

What it means

After the opening `---`, `extract_frontmatter` scans for a closing delimiter: a line consisting exactly of `---` at column 0 (followed by newline or EOF). Lines like `----`, `--- trailing`, or an indented ` ---` are deliberately not candidates. If no candidate exists, the YAML block is unterminated and the file is rejected.

Solutions

  1. Add a line containing exactly `---` after the metadata block.
  2. Check for trailing characters after the dashes (`--- ` with trailing spaces is fine only if the line is otherwise exactly dashes — remove any text).
  3. Use exactly three dashes; `----` is treated as body content, not a delimiter.
  4. Keep the closer at column 0 with no indentation.

Example fix

# SKILL.md — before (no closer)
---
name: my-skill
description: ...
# Body starts here

# SKILL.md — after
---
name: my-skill
description: ...
---
# Body starts here
Defensive patterns

Strategy: validation

Validate before calling

fn has_frontmatter_closer(content: &str) -> bool {
    let mut lines = content.trim_start().lines();
    lines.next(); // opener
    lines.any(|line| line == "---")
}

Try / catch

match agent_skills::parse_skill_file_content(&content) {
    Err(e) if e.to_string().contains("missing closing frontmatter delimiter") => {
        // insert `---` after the metadata block and reload
    }
    rest => rest,
}

Prevention

When it happens

Trigger: A SKILL.md with an opening `---` but no closing one; a closer written as `----` (four dashes); a closer with trailing spaces/text; horizontal rules in the body being mistaken for the closer while the real closer is missing.

Common situations: Hand-writing frontmatter and forgetting the terminator; markdown formatters converting the closer into a longer rule; editing the file and accidentally deleting the second `---`.

Related errors


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

Appendix: source

Thrown at crates/agent_skills/agent_skills.rs:390

        let after_dashes = line_start + 3;
        let end = if after_dashes == bytes.len() {
            after_dashes
        } else if bytes[after_dashes] == b'\n' {
            after_dashes + 1
        } else if after_dashes + 1 < bytes.len()
            && bytes[after_dashes] == b'\r'
            && bytes[after_dashes + 1] == b'\n'
        {
            after_dashes + 2
        } else {
            // Line is something like `---trailing` or `----`; not a candidate.
            continue;
        };
        candidates.push(end);
    }

    if candidates.is_empty() {
        anyhow::bail!("SKILL.md missing closing frontmatter delimiter (---)");
    }

    // Try each candidate in order: slice content up through the candidate's
    // 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)),
        }

View on GitHub (pinned to 9d272b0363)