{"record":{"id":"3a62d34dd3acd61e","repo":"FuelLabs/sway","slug":"cannot-find-local-repo-at-checkouts-dir","errorCode":null,"errorMessage":"Cannot find local repo at checkouts dir {}","messagePattern":"Cannot find local repo at checkouts dir (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"forc-pkg/src/source/git/mod.rs","lineNumber":674,"sourceCode":"/// Search local checkouts directory and apply the given function. This is used for iterating over\n/// possible options of a given package.\nfn with_search_checkouts<F>(checkouts_dir: PathBuf, package_name: &str, mut f: F) -> Result<()>\nwhere\n    F: FnMut(SourceIndex, PathBuf) -> Result<()>,\n{\n    for entry in fs::read_dir(checkouts_dir)? {\n        let entry = entry?;\n        let folder_name = entry\n            .file_name()\n            .into_string()\n            .map_err(|_| anyhow!(\"invalid folder name\"))?;\n        if folder_name.starts_with(package_name) {\n            // Search if the dir we are looking starts with the name of our package\n            for repo_dir in fs::read_dir(entry.path())? {\n                // Iterate over all dirs inside the `name-***` directory and try to open repo from\n                // each dirs inside this one\n                let repo_dir = repo_dir\n                    .map_err(|e| anyhow!(\"Cannot find local repo at checkouts dir {}\", e))?;\n                if repo_dir.file_type()?.is_dir() {\n                    // Get the path of the current repo\n                    let repo_dir_path = repo_dir.path();\n                    // Get the index file from the found path\n                    if let Ok(index_file) = fs::read_to_string(repo_dir_path.join(\".forc_index\")) {\n                        let index = serde_json::from_str(&index_file)?;\n                        f(index, repo_dir_path)?;\n                    }\n                }\n            }\n        }\n    }\n    Ok(())\n}\n\n#[test]\nfn test_source_git_pinned_parsing() {\n    let strings = [","sourceCodeStart":656,"sourceCodeEnd":692,"githubUrl":"https://github.com/FuelLabs/sway/blob/47e5e902faa42baf652dd6a0c88cd23390c1a614/forc-pkg/src/source/git/mod.rs#L656-L692","documentation":"The same offline scan iterates read_dir of each candidate directory; any per-entry IO error (permission problem, entry disappearing mid-iteration, unreadable directory) is wrapped with this message and the underlying io::Error text.","triggerScenarios":"Filesystem-level problems while iterating ~/.forc/git/checkouts: entries removed concurrently by another forc process, permission changes mid-run, or failing/network-mounted disks.","commonSituations":"Two forc/build processes racing on the same FORC_HOME; permission edits during a build; NFS-mounted HOME flakiness.","solutions":["Do not run concurrent forc builds sharing the same FORC_HOME, or ensure advisory path locks are respected","Fix permissions on the printed directory and retry the build","If the underlying error looks transient (network filesystem), retry the command once"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"let manifest = match pin_git_source(&source) {\n    Ok(m) => m,\n    Err(e) if e.to_string().contains(\"Cannot find local repo at checkouts dir\") => {\n        // transient fs error while scanning: wait and retry once\n        std::thread::sleep(std::time::Duration::from_secs(2));\n        pin_git_source(&source)?\n    }\n    Err(e) => return Err(e),\n};","preventionTips":["Serialize builds that share the same FORC_HOME cache","Keep the forc cache on local disk, not network mounts","Fix permissions on cache dirs before builds"],"tags":["filesystem","offline","concurrency","cache"],"backgroundTag":null,"analyzedSha":"47e5e902faa42baf652dd6a0c88cd23390c1a614","analyzedAt":"2026-08-16T07:57:45.555Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}