{"record":{"id":"f27d9315731ecd2d","repo":"GitoxideLabs/gitoxide","slug":"failed-to-handle-num-errors-repositories","errorCode":null,"errorMessage":"Failed to handle {num_errors} repositories","messagePattern":"Failed to handle (.+?) repositories","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gitoxide-core/src/organize.rs","lineNumber":316,"sourceCode":"    let mut num_errors = 0usize;\n    let destination = destination.as_ref().canonicalize()?;\n    let mut repositories =\n        find_git_repository_workdirs(source_dir, progress.add_child(\"Searching repositories\"), false, threads)\n            .collect::<Vec<_>>();\n    repositories.sort_unstable_by(|a, b| a.0.cmp(&b.0));\n    for (path_to_move, kind) in repositories {\n        if let Err(err) = handle(mode, kind, &path_to_move, &destination, &mut progress) {\n            progress.fail(format!(\n                \"Error when handling directory {:?}: {}\",\n                path_to_move.display(),\n                err\n            ));\n            num_errors += 1;\n        }\n    }\n\n    if num_errors > 0 {\n        anyhow::bail!(\"Failed to handle {num_errors} repositories\")\n    } else {\n        Ok(())\n    }\n}\n","sourceCodeStart":298,"sourceCodeEnd":321,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gitoxide-core/src/organize.rs#L298-L321","documentation":"Thrown at the end of an `organize` run (`gitoxide_core::organize::run`) when one or more repositories could not be handled. Individual failures are recorded during the loop (with `num_errors` incremented per failure) and this final bail summarizes the count.","triggerScenarios":"Running the organize command over a set of repositories where at least one repository fails handling - e.g. a repository open/operation error inside the per-repo processing loop.","commonSituations":"Corrupted or non-git directories inside the organized tree; permission problems on some repos; a repository locked by another process; one bad repo aborting an otherwise-successful batch.","solutions":["Check per-repository error output earlier in the run to find the failing repositories","Fix or remove the problematic repositories, then re-run organize","Check permissions and that each target path is a valid git repository","Re-run with a narrower set of repositories to isolate the failure"],"exampleFix":"// before\ngix organize ./repos/   # fails: 2 repositories could not be handled\n// after\n# inspect and fix the failing repos, e.g. remove corrupt one\nrm -rf ./repos/corrupt-repo\ngix organize ./repos/","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"let result = organize::run(/* args */);\nif let Err(e) = &result {\n    eprintln!(\"{e}; inspect per-repository errors above\");\n}","preventionTips":["Run batch operations with logging per item","Quarantine known-bad repositories before batch runs"],"tags":["git","batch-processing","filesystem","cli"],"backgroundTag":"git-command-failed","analyzedSha":"e73179060badf27222d790981fac3f84c1830a7e","analyzedAt":"2026-09-08T11:26:50.865Z","contentChangedAt":"2026-09-08T11:26:50.865Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}