{"record":{"id":"49089db22e266ae3","repo":"Hmbown/CodeWhale","slug":"user-command-registry-lock-poisoned","errorCode":null,"errorMessage":"user command registry lock poisoned","messagePattern":"user command registry lock poisoned","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/commands/user_registry.rs","lineNumber":641,"sourceCode":"        .read()\n        .expect(\"user command registry lock poisoned\")\n        .registry\n        .clone()\n}\n\n#[cfg(test)]\npub fn registry_for_workspace(workspace: Option<&Path>) -> UserCommandRegistry {\n    with_registry_for_workspace(workspace, Clone::clone)\n}\n\npub fn with_registry_for_workspace<R>(\n    workspace: Option<&Path>,\n    f: impl FnOnce(&UserCommandRegistry) -> R,\n) -> R {\n    let workspace = normalize_workspace(workspace);\n    let lock = registry_lock();\n    let (plugin_sources, plugin_errors) = {\n        let guard = lock.read().expect(\"user command registry lock poisoned\");\n        if guard.plugin_workspace == workspace {\n            (guard.plugin_sources.clone(), guard.plugin_errors.clone())\n        } else {\n            (Vec::new(), Vec::new())\n        }\n    };\n    let snapshot = command_dirs_snapshot_with_plugins(workspace.as_deref(), &plugin_sources);\n    {\n        let guard = lock.read().expect(\"user command registry lock poisoned\");\n        if !registry_needs_reload(&guard, &workspace, &snapshot) {\n            return f(&guard.registry);\n        }\n    }\n\n    let replacement = UserCommandRegistry::load_with_sources(\n        &user_commands::commands_dirs(workspace.as_deref()),\n        &user_commands::workflow_dirs(workspace.as_deref()),\n        &plugin_sources,","sourceCodeStart":623,"sourceCodeEnd":659,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/commands/user_registry.rs#L623-L659","documentation":"The global user-command registry RwLock was poisoned, meaning a thread panicked while holding the lock and its data may be inconsistent. Readers unwrap with this expect, so any later registry access aborts; the underlying cause is the earlier panic, not this call site.","triggerScenarios":"Thrown at crates/tui/src/commands/user_registry.rs:641 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Find and fix the panic that occurred while the registry lock was held","Switch to lock.read().unwrap_or_else(|e| e.into_inner()) if registry data is safe to reuse after poisoning","Scope lock guards tightly so fallible operations run outside the critical section"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}