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

failed to clone skills registry: {stderr}

Error message

failed to clone skills registry: {stderr}

What it means

clone_skills_repository clones the skills registry (the default SKILLS_REGISTRY_REPO_URL or a configured registry URL) into the workspace registry directory; git exited non-zero and stderr is embedded. Unlike a failed pull — where the runtime logs a warning and falls back to the stale local copy — a failed initial clone is fatal because there is nothing to fall back to.

Source

Thrown at crates/zeroclaw-runtime/src/skills/mod.rs:2202

fn clone_skills_repository(target_dir: &Path, repo_url: &str) -> Result<()> {
    if let Some(parent) = target_dir.parent() {
        std::fs::create_dir_all(parent).with_context(|| {
            format!(
                "failed to create registry parent: {}",
                parent.display().to_string()
            )
        })?;
    }

    let output = Command::new("git")
        .args(["clone", "--depth", "1", repo_url])
        .arg(target_dir)
        .output()
        .context("failed to run git clone for skills registry")?;

    if !output.status.success() {
        let stderr = String::from_utf8_lossy(&output.stderr);
        anyhow::bail!("failed to clone skills registry: {stderr}");
    }

    ::zeroclaw_log::record!(
        INFO,
        ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Note),
        &format!(
            "cloned skills registry to {}",
            target_dir.display().to_string()
        )
    );
    Ok(())
}

fn clone_skills_registry(registry_dir: &Path, repo_url: &str) -> Result<()> {
    clone_skills_repository(registry_dir, repo_url)?;
    mark_skills_registry_synced(registry_dir)?;
    Ok(())
}

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Verify 'git clone <registry-url>' succeeds from the same machine and account
  2. Fix or remove the configured registry URL to fall back to the default registry
  3. Retry once network/egress is available — the clone only happens when the registry dir is missing
  4. If you maintain a mirror, pre-seed the workspace registry directory (a git checkout including .git) so only a pull is attempted
Defensive patterns

Strategy: retry

Validate before calling

// Pre-seed the workspace registry during provisioning so first-run never clones:
// provisioner side:
if !registry_dir.exists() {
    run!("git clone --depth 1 <registry-url> {registry_dir}")?; // fail fast in setup, not at runtime
}

Try / catch

match ensure_skills_registry(&workspace, registry_url) {
    Err(e) if e.to_string().starts_with("failed to clone skills registry") => {
        // registry bootstrap failed: verify configured registry_url with a manual
        // git clone, fix network/credentials, then retry the operation
    }
    r => r,
}

Prevention

When it happens

Trigger: First skill operation in a fresh workspace while offline; a custom configured registry URL that is wrong or unreachable; auth required for the registry repository; host outage or rate limiting.

Common situations: Air-gapped or proxied machines; registry_url typo in config; GitHub incidents; first-run on CI with restricted egress.

Related errors


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