{"record":{"id":"16ce38fbadec9b6d","repo":"nikivdev/code","slug":"flow-repo-not-found-at","errorCode":null,"errorMessage":"flow repo not found at {}","messagePattern":"flow repo not found at (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/latest.rs","lineNumber":22,"sourceCode":"use anyhow::{Context, Result, bail};\n\nuse crate::cli::DeployCommand;\nuse crate::deploy;\n\npub fn run() -> Result<()> {\n    let flow_root = flow_repo_root()?;\n    update_flow_repo(&flow_root)?;\n    rebuild_flow(&flow_root)?;\n    reload_fish_shell()?;\n    Ok(())\n}\n\nfn flow_repo_root() -> Result<PathBuf> {\n    let root = dirs::home_dir()\n        .context(\"failed to resolve home directory\")?\n        .join(\"code/flow\");\n    if !root.exists() {\n        bail!(\"flow repo not found at {}\", root.display());\n    }\n    Ok(root)\n}\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()","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/latest.rs#L4-L40","documentation":"flow_repo_root resolves the developer's local `~/code/flow` checkout. If the home directory resolves but the `code/flow` path does not exist on disk, it bails with this error naming the missing path. It is an environment precondition check before updating the flow repo.","triggerScenarios":"Calling run (which calls flow_repo_root) when `~/.cargo`-style home is resolved via dirs::home_dir() but `$HOME/code/flow` does not exist — e.g. fresh machine, repo cloned elsewhere, or HOME pointing at a different user.","commonSituations":"New workstation setup without cloning the flow repo; flow repo moved to a non-default location; running the tool in CI or a container where HOME differs; typo'd/renamed checkout directory.","solutions":["Clone the flow repository to `~/code/flow` (git clone <flow-repo-url> ~/code/flow)","If the repo lives elsewhere, create a symlink: ln -s /actual/path/flow ~/code/flow","Verify HOME is set to the expected user's home and that ~/code/flow exists (ls ~/code/flow)"],"exampleFix":"// before (fails on fresh machine)\nbail!(\"flow repo not found at {}\", root.display());\n// after (make the root configurable)\nlet root = std::env::var(\"FLOW_REPO\")\n    .map(PathBuf::from)\n    .unwrap_or_else(|_| dirs::home_dir().unwrap().join(\"code/flow\"));","handlingStrategy":"validation","validationCode":"let root = dirs::home_dir().unwrap().join(\"code/flow\");\nif !root.exists() {\n    eprintln!(\"flow repo missing at {} — clone it first\", root.display());\n    std::process::exit(1);\n}","typeGuard":"fn flow_repo_present() -> bool {\n    dirs::home_dir().map(|h| h.join(\"code/flow\").is_dir()).unwrap_or(false)\n}","tryCatchPattern":"match flow_repo_root() {\n    Ok(root) => update_flow_repo(&root)?,\n    Err(e) if e.to_string().contains(\"flow repo not found\") => {\n        eprintln!(\"Hint: clone the flow repo to ~/code/flow\");\n        return Err(e);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Clone the flow repo to ~/code/flow as part of machine setup","Symlink non-standard checkout locations to ~/code/flow","Set a FLOW_REPO-style env override in the tool instead of relying on a fixed path"],"tags":["filesystem","environment","path-not-found"],"backgroundTag":"missing-directory","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}