nikivdev/code · error

not a git repository (or git not available)

Error message

not a git repository (or git not available)

What it means

Error "not a git repository (or git not available)" thrown in nikivdev/code.

Source

Thrown at src/fix.rs:230

fn print_manual_fix_next_steps(message: &str) {
    let preview = message.lines().next().unwrap_or(message).trim();
    println!();
    println!("Next steps:");
    println!("  1) Make the requested repair manually or in Codex");
    println!("  2) Review the diff");
    println!("  3) Run `f commit` to recreate the commit cleanly");
    if !preview.is_empty() {
        println!("  Context: {}", preview);
    }
}

fn git_top_level() -> Result<std::path::PathBuf> {
    let output = Command::new("git")
        .args(["rev-parse", "--show-toplevel"])
        .output()
        .context("failed to run git")?;
    if !output.status.success() {
        bail!("not a git repository (or git not available)");
    }
    let root = String::from_utf8_lossy(&output.stdout).trim().to_string();
    if root.is_empty() {
        bail!("failed to resolve git repository root");
    }
    Ok(std::path::PathBuf::from(root))
}

fn ensure_clean_or_stash(
    repo_root: &std::path::Path,
    allow_stash: bool,
    stashed: &mut bool,
) -> Result<()> {
    let status = git_output(repo_root, &["status", "--porcelain"])?;
    if status.trim().is_empty() {
        return Ok(());
    }

View on GitHub (pinned to a747e741ae)

When it happens

Trigger: Thrown at src/fix.rs:230 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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