{"record":{"id":"9b379443ff0bfa34","repo":"nikivdev/code","slug":"git-pull-failed","errorCode":null,"errorMessage":"git pull failed","messagePattern":"git pull failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/latest.rs","lineNumber":43,"sourceCode":"}\n\nfn update_flow_repo(root: &PathBuf) -> Result<()> {\n    println!(\"Updating {}\", root.display());\n    let status = Command::new(\"git\")\n        .args([\n            \"-C\",\n            root.to_str().unwrap_or(\"\"),\n            \"pull\",\n            \"--rebase\",\n            \"--autostash\",\n        ])\n        .stdin(Stdio::inherit())\n        .stdout(Stdio::inherit())\n        .stderr(Stdio::inherit())\n        .status()\n        .context(\"failed to run git pull\")?;\n    if !status.success() {\n        bail!(\"git pull failed\");\n    }\n    Ok(())\n}\n\nfn rebuild_flow(root: &PathBuf) -> Result<()> {\n    let prev = std::env::current_dir().context(\"failed to read current directory\")?;\n    std::env::set_current_dir(root)\n        .with_context(|| format!(\"failed to switch to {}\", root.display()))?;\n    let result = deploy::run(DeployCommand { action: None });\n    std::env::set_current_dir(prev).context(\"failed to restore previous directory\")?;\n    result\n}\n\nfn reload_fish_shell() -> Result<()> {\n    if std::env::var(\"FISH_VERSION\").is_err() {\n        return Ok(());\n    }\n    if !atty::is(atty::Stream::Stdout) {","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/latest.rs#L25-L61","documentation":"update_flow_repo shells out to `git pull` in the flow repo with inherited stdio. If the child git process exits with a non-zero status, the wrapper bails with this generic error. The detailed reason is only visible on stderr, not in the error message itself.","triggerScenarios":"Running run (which calls update_flow_repo) when `git pull` fails: no remote configured, no upstream branch, merge conflicts with local changes, network/auth failure to the remote, or detached HEAD state.","commonSituations":"Local commits/diverged branch in ~/code/flow; VPN off or credentials expired so the remote is unreachable; repo cloned without pushing an upstream branch; rebase conflicts with dirty working tree.","solutions":["Read the git stderr printed above the error to see the actual cause, then fix git state (e.g. git -C ~/code/flow status)","Resolve conflicts or stash/discard local changes, then pull manually: git -C ~/code/flow pull","Set upstream/auth: git -C ~/code/flow branch --set-upstream-to=origin/<branch> and refresh credentials; check network/VPN"],"exampleFix":"// before\nif !status.success() {\n    bail!(\"git pull failed\");\n}\n// after\nif !status.success() {\n    bail!(\"git pull failed in {} (exit code {:?})\", root.display(), status.code());\n}","handlingStrategy":"try-catch","validationCode":"let status = std::process::Command::new(\"git\")\n    .args([\"-C\", \"~/code/flow\", \"status\", \"--porcelain\"])\n    .status()\n    .expect(\"git not available\");\nif !status.success() {\n    eprintln!(\"flow repo git state is broken; fix before updating\");\n}","typeGuard":null,"tryCatchPattern":"if let Err(e) = update_flow_repo(&root) {\n    if e.to_string().contains(\"git pull failed\") {\n        eprintln!(\"See git stderr above; try: git -C ~/code/flow pull manually\");\n    }\n    return Err(e);\n}","preventionTips":["Keep ~/code/flow on a clean tracking branch (no local commits/conflicts)","Keep remote credentials/SSH agent working; check VPN before running","Run git pull manually once after cloning to establish upstream"],"tags":["git","subprocess","network"],"backgroundTag":"git-pull-failed","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}