{"record":{"id":"a8333248810e923a","repo":"GitoxideLabs/gitoxide","slug":"successful-iteration-has-outcome","errorCode":null,"errorMessage":"successful iteration has outcome","messagePattern":"successful iteration has outcome","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"gitoxide-core/src/repository/status.rs","lineNumber":202,"sourceCode":"                    out,\n                    \"{status: >3} {source_rela_path} → {dest_rela_path}\",\n                    status = \"R\",\n                    source_rela_path =\n                        gix::path::relativize_with_prefix(&gix::path::from_bstr(source.rela_path()), prefix).display(),\n                    dest_rela_path = gix::path::relativize_with_prefix(\n                        &gix::path::from_bstr(dirwalk_entry.rela_path.as_bstr()),\n                        prefix\n                    )\n                    .display(),\n                )?;\n            }\n        }\n    }\n    if gix::interrupt::is_triggered() {\n        bail!(\"interrupted by user\");\n    }\n\n    let out = iter.outcome_mut().expect(\"successful iteration has outcome\");\n\n    if out.has_changes() && allow_write {\n        out.write_changes().transpose()?;\n    }\n\n    if statistics {\n        writeln!(err, \"{outcome:#?}\", outcome = out.index_worktree).ok();\n    }\n\n    progress.init(Some(out.worktree_index.entries().len()), gix::progress::count(\"files\"));\n    progress.set(out.worktree_index.entries().len());\n    progress.show_throughput(start);\n    Ok(())\n}\n\nfn print_index_entry_status(\n    out: &mut dyn std::io::Write,\n    prefix: &Path,","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gitoxide-core/src/repository/status.rs#L184-L220","documentation":"After a status iteration completes successfully, `iter.outcome_mut()` is expected to hold the computed outcome. The `.expect()` panics if iteration reported success but no outcome was stored, indicating a bug in gix's status machinery rather than a user error.","triggerScenarios":"Calling the `show` status path where `iter` finished without error but `outcome_mut()` returned `None` (e.g. iteration never ran to completion internally).","commonSituations":"Interrupted status computation that nonetheless reported success; gix version mismatch where the outcome type changed; a genuine library bug surfacing in the CLI.","solutions":["Update gix/gitoxide to the latest version to pick up fixed outcome-propagation bugs.","Ensure the status iteration runs to completion before requesting `outcome_mut()` (propagate the iteration Result).","Handle `None` gracefully in the CLI (bail with a message) instead of panicking."],"exampleFix":"// before\nlet out = iter.outcome_mut().expect(\"successful iteration has outcome\");\n\n// after\nlet Some(out) = iter.outcome_mut() else {\n    bail!(\"status iteration produced no outcome\");\n};","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"let Some(out) = iter.outcome_mut() else {\n    bail!(\"status iteration produced no outcome despite success\");\n};","preventionTips":["Propagate the iteration Result fully before reading the outcome","Handle interrupts (gix::interrupt) before consuming outcomes","Report None outcomes as errors instead of panicking in CLI code"],"tags":["git","status","panic","invariant"],"backgroundTag":"internal-invariant-violation","analyzedSha":"e73179060badf27222d790981fac3f84c1830a7e","analyzedAt":"2026-09-08T11:26:50.865Z","contentChangedAt":"2026-09-08T11:26:50.865Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}