{"record":{"id":"4eb2021cc8beb5dd","repo":"Hmbown/CodeWhale","slug":"ops-origin-main-archive-missing-check-auto-merge-script","errorCode":null,"errorMessage":"ops origin/main archive missing {CHECK_AUTO_MERGE_SCRIPT}","messagePattern":"ops origin/main archive missing (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/operate.rs","lineNumber":916,"sourceCode":"    let mut child = Command::new(\"tar\")\n        .arg(\"-x\")\n        .arg(\"-C\")\n        .arg(&dest)\n        .stdin(Stdio::piped())\n        .stdout(Stdio::null())\n        .stderr(Stdio::piped())\n        .spawn()\n        .context(\"tar extract ops origin/main\")?;\n    if let Some(mut stdin) = child.stdin.take() {\n        use std::io::Write;\n        stdin.write_all(&archive.stdout)?;\n    }\n    let status = child.wait()?;\n    if !status.success() {\n        anyhow::bail!(\"failed to extract ops origin/main archive\");\n    }\n    if !marker.is_file() {\n        anyhow::bail!(\"ops origin/main archive missing {CHECK_AUTO_MERGE_SCRIPT}\");\n    }\n    Ok(dest)\n}\n\npub fn default_operate_dir() -> PathBuf {\n    if let Ok(path) = std::env::var(\"CODEWHALE_OPERATE_DIR\") {\n        let trimmed = path.trim();\n        if !trimmed.is_empty() {\n            return PathBuf::from(trimmed);\n        }\n    }\n    crate::automation_manager::default_automations_dir()\n        .parent()\n        .map(|parent| parent.join(\"operate\"))\n        .unwrap_or_else(|| PathBuf::from(\"operate\"))\n}\n\npub struct OperationStore {","sourceCodeStart":898,"sourceCodeEnd":934,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/operate.rs#L898-L934","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Fetch the latest origin/main (`git fetch origin`) and retry so the archive includes the ops scripts","Verify the script exists on origin/main: `git ls-tree origin/main agent-workstreams/`","Update the library or path expectation if CHECK_AUTO_MERGE_SCRIPT was renamed upstream","Point discovery at a revision known to contain the ops tooling"],"exampleFix":"// before (shell)\ngit archive origin/main -- agent-workstreams/old-path\n// after (shell)\ngit fetch origin && git archive origin/main -- agent-workstreams/AUTO_MERGE.toml","handlingStrategy":"validation","validationCode":"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);","typeGuard":null,"tryCatchPattern":"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?, }","preventionTips":["Fetch the latest origin/main before relying on ops tooling","Confirm expected script paths exist on the branch after upstream changes","Keep the library's expected path constants in sync with the ops repo"],"tags":["git","archive","integrity-check"],"backgroundTag":"file-not-found","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}