zeroclaw-labs/zeroclaw · error · anyhow::Error

Skill name is empty or only dots after sanitization

Error message

Skill name is empty or only dots after sanitization

What it means

sanitize_path_component found that after trimming whitespace and stripping leading/trailing dots the skill name is empty. The name is about to become a directory under the skills root, so a null/dot-only name is rejected as an unusable path component.

Solutions

  1. Give the skill a name containing at least one non-dot character.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/zeroclaw-runtime/src/skillforge/integrate.rs:153 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/fcdeb105de80ebaf. Report an issue: GitHub.

Appendix: source

Thrown at crates/zeroclaw-runtime/src/skillforge/integrate.rs:153

}

/// Escape special characters for TOML basic string values.
fn escape_toml(s: &str) -> String {
    s.replace('\\', "\\\\")
        .replace('"', "\\\"")
        .replace('\n', "\\n")
        .replace('\r', "\\r")
        .replace('\t', "\\t")
        .replace('\u{08}', "\\b")
        .replace('\u{0C}', "\\f")
}

/// Sanitize a string for use as a single path component.
/// Rejects empty names, "..", and names containing path separators or NUL.
fn sanitize_path_component(name: &str) -> Result<String> {
    let trimmed = name.trim().trim_matches('.');
    if trimmed.is_empty() {
        bail!("Skill name is empty or only dots after sanitization");
    }
    let sanitized: String = trimmed
        .chars()
        .map(|c| match c {
            '/' | '\\' | '\0' => '_',
            _ => c,
        })
        .collect();
    if sanitized == ".." || sanitized.contains('/') || sanitized.contains('\\') {
        bail!("Skill name '{}' is unsafe as a path component", name);
    }
    Ok(sanitized)
}

// ---------------------------------------------------------------------------
// Tests
// ---------------------------------------------------------------------------

View on GitHub (pinned to 88bb9c8533)