{"record":{"id":"1305d455c3333273","repo":"zed-industries/zed","slug":"failed-to-unwrap-mutex","errorCode":null,"errorMessage":"Failed to unwrap Mutex","messagePattern":"Failed to unwrap Mutex","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/edit_prediction_cli/src/predict.rs","lineNumber":337,"sourceCode":"        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,\n                batched,\n                repetition_count,","sourceCodeStart":319,"sourceCodeEnd":355,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/edit_prediction_cli/src/predict.rs#L319-L355","documentation":"After unwrapping the Arc, run_prediction locks the example's Mutex via into_inner; it fails because the mutex was still locked elsewhere (a task holding the guard leaked or panicked), so exclusive access cannot be obtained.","triggerScenarios":"Thrown at crates/edit_prediction_cli/src/predict.rs:337 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Find and fix the task that retains the mutex guard (often a panicked worker)","Ensure guards are scoped so they drop before prediction finishes"],"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-14T00:17:10.932Z"}