Hmbown/CodeWhale · error

ops origin/main archive missing

Error message

ops origin/main archive missing {CHECK_AUTO_MERGE_SCRIPT}

What it means

Post-extraction integrity check: materialize_ops_origin_main requires the CHECK_AUTO_MERGE_SCRIPT marker file to exist in the extracted tree. If tar succeeded but the marker is missing, the archive did not contain the expected ops content, so the result cannot be trusted.

Solutions

  1. Fetch the latest origin/main (`git fetch origin`) and retry so the archive includes the ops scripts
  2. Verify the script exists on origin/main: `git ls-tree origin/main agent-workstreams/`
  3. Update the library or path expectation if CHECK_AUTO_MERGE_SCRIPT was renamed upstream
  4. Point discovery at a revision known to contain the ops tooling

Example fix

// before (shell)
git archive origin/main -- agent-workstreams/old-path
// after (shell)
git fetch origin && git archive origin/main -- agent-workstreams/AUTO_MERGE.toml
Defensive patterns

Strategy: validation

Validate before calling

let has_marker = std::process::Command::new("git").args(["ls-tree","origin/main","agent-workstreams/AUTO_MERGE.toml"]).output().map(|o| !o.stdout.is_empty()).unwrap_or(false);

Try / catch

match materialize_ops_origin_main(dest) { Err(e) if e.to_string().contains("missing") && e.to_string().contains("AUTO_MERGE") => eprintln!("origin/main lacks ops scripts; fetch newer main or upgrade"), other => other?, }

Prevention

When it happens

Trigger: origin/main's tree lacks `agent-workstreams/AUTO_MERGE.toml` / the check-auto-merge script path, or the archive filter paths changed on the branch, so extraction succeeds but the marker is absent.

Common situations: Older origin/main revision before the ops scripts were added; upstream rename/removal of the script path; wrong branch fetched under origin/main; typo in the expected path after a version change.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/4eb2021cc8beb5dd. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/operate.rs:916

    let mut child = Command::new("tar")
        .arg("-x")
        .arg("-C")
        .arg(&dest)
        .stdin(Stdio::piped())
        .stdout(Stdio::null())
        .stderr(Stdio::piped())
        .spawn()
        .context("tar extract ops origin/main")?;
    if let Some(mut stdin) = child.stdin.take() {
        use std::io::Write;
        stdin.write_all(&archive.stdout)?;
    }
    let status = child.wait()?;
    if !status.success() {
        anyhow::bail!("failed to extract ops origin/main archive");
    }
    if !marker.is_file() {
        anyhow::bail!("ops origin/main archive missing {CHECK_AUTO_MERGE_SCRIPT}");
    }
    Ok(dest)
}

pub fn default_operate_dir() -> PathBuf {
    if let Ok(path) = std::env::var("CODEWHALE_OPERATE_DIR") {
        let trimmed = path.trim();
        if !trimmed.is_empty() {
            return PathBuf::from(trimmed);
        }
    }
    crate::automation_manager::default_automations_dir()
        .parent()
        .map(|parent| parent.join("operate"))
        .unwrap_or_else(|| PathBuf::from("operate"))
}

pub struct OperationStore {

View on GitHub (pinned to 73e0f67d83)