nikivdev/code · error

{} failed

Error message

{} failed

What it means

Generic failure message emitted when an operation on a repository (e.g. fetch, pull, or push) fails; the repository identity is interpolated into the message.

Source

Thrown at src/repos.rs:1430

    let script_path = runtime_assets::require_asset_path("scripts/private_mirror.py")?;
    let output = Command::new("python3")
        .arg(&script_path)
        .args(args)
        .current_dir(repo_root)
        .output()
        .with_context(|| format!("failed to run {}", script_path.display()))?;
    if !output.status.success() {
        let stderr = String::from_utf8_lossy(&output.stderr);
        let stdout = String::from_utf8_lossy(&output.stdout);
        let message = stderr.trim();
        if !message.is_empty() {
            bail!("{}", message);
        }
        let message = stdout.trim();
        if !message.is_empty() {
            bail!("{}", message);
        }
        bail!("{} failed", script_path.display());
    }
    Ok(String::from_utf8_lossy(&output.stdout).to_string())
}

fn parse_github_remote_url(url: &str) -> Option<GithubRemoteRef> {
    let trimmed = url.trim().trim_end_matches('/');
    let path = if let Some(rest) = trimmed.strip_prefix("git@github.com:") {
        rest.trim_end_matches(".git")
    } else if let Some(rest) = trimmed.strip_prefix("https://") {
        let rest = rest.strip_prefix("github.com/").or_else(|| {
            let (_userinfo, host_and_path) = rest.split_once('@')?;
            host_and_path.strip_prefix("github.com/")
        })?;
        rest.trim_end_matches(".git")
    } else if let Some(rest) = trimmed.strip_prefix("https://github.com/") {
        rest.trim_end_matches(".git")
    } else {
        return None;

View on GitHub (pinned to a747e741ae)

Solutions

  1. Run the script manually and observe its exit code and output.
  2. Add `set -e` and explicit echo-to-stderr diagnostics to the script.
  3. Check the script's shebang/interpreter exists and file is executable.

Example fix

// before: silent failure
#!/bin/sh
test -f $REQUIRED && exit 0 || exit 1
// after
#!/bin/sh
test -f $REQUIRED || { echo "missing $REQUIRED" >&2; exit 1; }
Defensive patterns

Strategy: fallback

Validate before calling

fn script_ready(p: &std::path::Path) -> bool {
    p.exists()
        && p.metadata().map_or(false, |m| {
            use std::os::unix::fs::PermissionsExt;
            m.permissions().mode() & 0o111 != 0
        })
        && std::fs::read_to_string(p)
            .ok()
            .and_then(|c| c.lines().next().map(|l| l.starts_with("#!")))
            .unwrap_or(false)
}

Try / catch

match run_repo_script(&script_path) {
    Err(e) if e.to_string().ends_with("failed") => {
        eprintln!("script produced no output; run manually to debug:");
        eprintln!("  $ {}", script_path.display());
    }
    Err(e) => eprintln!("script error: {e}"),
    Ok(_) => {}
}

Prevention

When it happens

Trigger: Script exits with a non-zero status while producing no output on either stream (silent failure, immediate crash, or signal kill).

Common situations: Scripts with `exit 1` and no message; missing interpreter causing silent failure; scripts killed by a signal; output swallowed by redirection inside the script.

Related errors


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/e8e920540d2d2bee. Report an issue: GitHub.