Hmbown/CodeWhale · error

SKILL.md `name` must be a single path-safe segment

Error message

SKILL.md `name` must be a single path-safe segment (got '{name}')

What it means

After parsing SKILL.md frontmatter, the 'name' field must exist, a 'description' must exist, and the name must pass validate_skill_name_segment (single path-safe segment). This bails when the frontmatter name fails that segment check, keeping the installed directory name safe.

Solutions

  1. Edit SKILL.md frontmatter so name is a single path-safe segment, e.g. name: my-skill
  2. Remove whitespace, slashes, and backslashes from the name
  3. Keep 'description:' present and non-empty alongside the valid name

Example fix

// before
---
name: My Cool Skill/sub
description: x
---
// after
---
name: my-cool-skill
description: x
---
Defensive patterns

Strategy: validation

Validate before calling

let name = frontmatter.get("name").ok_or("missing name")?;
assert!(!name.contains('/') && !name.contains('\\') && !name.chars().any(char::is_whitespace)
    && name != "." && name != ".." && !name.is_empty(), "invalid skill name in frontmatter");
assert!(frontmatter.contains_key("description"), "missing description");

Type guard

fn is_valid_frontmatter_name(name: &str) -> bool {
    !name.is_empty() && name.trim() == name && !name.chars().any(char::is_whitespace)
        && name != "." && name != ".." && !name.contains('/') && !name.contains('\\')
}

Try / catch

match install_skill(pkg) {
    Err(e) if e.to_string().contains("`name`") => eprintln!("fix SKILL.md frontmatter name to a single path-safe segment"),
    other => other?,
}

Prevention

When it happens

Trigger: A SKILL.md with name: containing slashes, whitespace, dot segments, or otherwise failing the single path-safe segment rules; or a name present but description missing (different but adjacent failure).

Common situations: Frontmatter name copied from a URL path; names with spaces like 'My Cool Skill'; names authored as 'skills/foo'.

Understand the failure class

Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/c08390995477b67e. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/skills/install.rs:1628

            continue;
        }
        if let Some((key, value)) = line.split_once(':') {
            let key = key.trim().to_ascii_lowercase();
            let value = value.trim().to_string();
            match key.as_str() {
                "name" if !value.is_empty() => name = Some(value),
                "description" if !value.is_empty() => has_description = true,
                _ => {}
            }
        }
    }

    let name = name.ok_or(InstallError::MissingFrontmatterField("name"))?;
    if !has_description {
        return Err(InstallError::MissingFrontmatterField("description").into());
    }
    if validate_skill_name_segment(&name).is_err() {
        bail!("SKILL.md `name` must be a single path-safe segment (got '{name}')");
    }
    Ok(name)
}

fn reject_unmarked_update(final_path: &Path, name: &str) -> std::result::Result<(), InstallError> {
    if final_path.join(INSTALLED_FROM_MARKER).exists() {
        Ok(())
    } else {
        Err(InstallError::NotInstalledHere(name.to_string()))
    }
}

pub(crate) fn source_spec_string(source: &InstallSource) -> String {
    match source {
        InstallSource::GitHubRepo(repo) => format!("github:{repo}"),
        InstallSource::DirectUrl(url) => url.clone(),
        InstallSource::Registry(name) => name.clone(),
    }

View on GitHub (pinned to 73e0f67d83)