{"record":{"id":"dd58d907ea48d3bb","repo":"zed-industries/zed","slug":"failed-to-unwrap-arc","errorCode":null,"errorMessage":"Failed to unwrap Arc","messagePattern":"Failed to unwrap Arc","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/edit_prediction_cli/src/predict.rs","lineNumber":335,"sourceCode":"            .actual_patch = actual_patch;\n\n        if ix == repetition_count - 1 {\n            let (info, style) = if has_prediction {\n                (\"predicted\", InfoStyle::Normal)\n            } else {\n                (\"no prediction\", InfoStyle::Warning)\n            };\n            step_progress.set_info(info, style);\n        }\n    }\n\n    ep_store.update(&mut cx, |store, _| {\n        store.remove_project(&state.project);\n    });\n    debug_task.await?;\n\n    *example = Arc::into_inner(updated_example)\n        .ok_or_else(|| anyhow::anyhow!(\"Failed to unwrap Arc\"))?\n        .into_inner()\n        .map_err(|_| anyhow::anyhow!(\"Failed to unwrap Mutex\"))?;\n    Ok(())\n}\n\nasync fn predict_teacher(\n    example: &mut Example,\n    backend: TeacherBackend,\n    batched: bool,\n    repetition_count: usize,\n    cache_only: bool,\n    step_progress: &crate::progress::StepProgress,\n) -> anyhow::Result<()> {\n    match backend {\n        TeacherBackend::Sonnet45 | TeacherBackend::Sonnet46 => {\n            predict_anthropic(\n                example,\n                backend,","sourceCodeStart":317,"sourceCodeEnd":353,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/edit_prediction_cli/src/predict.rs#L317-L353","documentation":"run_prediction tries to take unique ownership of the updated example via Arc::into_inner; it fails when other clones of the Arc still exist (a background task or subscriber hasn't dropped its reference), so the result cannot be unwrapped safely.","triggerScenarios":"Thrown at crates/edit_prediction_cli/src/predict.rs:335 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure all background tasks holding the example Arc complete or are dropped before this point","Restructure to avoid sharing the example across tasks"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}