clockworklabs/SpacetimeDB · error

Could not read skills directory at {}. Ensure skills/ exists

Error message

Could not read skills directory at {}. Ensure skills/ exists at the repo root.

What it means

Build-time panic in crates/cli/build.rs: `fs::read_dir` on the skills directory failed while discovering embedded skills (each subdirectory of skills/ containing a SKILL.md). The error is swallowed and replaced by this panic, so any read failure — directory missing, not a directory, or lacking permissions — produces the same message. The build requires a skills/ directory at the repo root to generate the skill-embedding code.

Source

Thrown at crates/cli/build.rs:523

        _ => {
            if let Some(parent) = path.parent() {
                fs::create_dir_all(parent)?;
            }
            let mut file = fs::File::create(path)?;
            file.write_all(contents)
        }
    }
}

/// Discover skill directories under skills/. Each directory containing a SKILL.md
/// file is considered a skill. Returns sorted skill names.
fn discover_skill_names(skills_dir: &Path) -> Vec<String> {
    let mut names = Vec::new();

    let entries = match fs::read_dir(skills_dir) {
        Ok(entries) => entries,
        Err(_) => {
            panic!(
                "Could not read skills directory at {}. Ensure skills/ exists at the repo root.",
                skills_dir.display()
            );
        }
    };

    for entry in entries.flatten() {
        let path = entry.path();
        if path.is_dir()
            && path.join("SKILL.md").exists()
            && let Some(name) = path.file_name().and_then(|n| n.to_str())
        {
            names.push(name.to_string());
        }
    }

    names.sort();
    names

View on GitHub (pinned to 6dee26c6ef)

Solutions

  1. Create or restore the directory: `git checkout HEAD -- skills` (or `mkdir skills` if genuinely empty, then add at least one skill dir with SKILL.md).
  2. Fix the build context: remove `skills` from .dockerignore/.gitignore-style exclusions and re-copy the full source.
  3. Verify `test -d skills && test -r skills && test -x skills` for the build user.
  4. Re-run `cargo build -p spacetimedb-cli`.
Defensive patterns

Strategy: validation

Validate before calling

# Before building the CLI:
test -d skills && test -r skills && echo "skills ok" || echo "skills/ missing or unreadable"

Prevention

When it happens

Trigger: Building the CLI from a source tree where skills/ was deleted or never copied (partial clone, trimmed Docker context, source tarball); skills/ existing as a file instead of a directory; permission denial for the build user.

Common situations: Docker/CI contexts excluding the new skills/ directory via .dockerignore or sparse-checkout; contributors on older checkouts pulling only crates/; packaging scripts that cherry-pick directories.

Related errors


AI-assisted analysis of clockworklabs/SpacetimeDB@6dee26c6ef (2026-08-20). Data as JSON: /api/errors/28f1dfadc997dc75. Report an issue: GitHub.