{"record":{"id":"7e294643a63247f6","repo":"Hmbown/CodeWhale","slug":"background-hook-supervisor-is-unavailable","errorCode":null,"errorMessage":"background hook supervisor is unavailable","messagePattern":"background hook supervisor is unavailable","errorType":"console","errorClass":"BackgroundSupervisorFailure::Disconnected","httpStatus":null,"severity":"warning","filePath":"crates/tui/src/hooks/executor.rs","lineNumber":2458,"sourceCode":"            plugin_authority: hook.plugin_authority.clone(),\n            project_authority: hook.project_authority.clone(),\n        });\n\n        // The result describes the bounded submission, not the run: no caller\n        // can mistake \"queued\" for \"exited 0\".\n        HookResult {\n            name: hook.name.clone(),\n            background: true,\n            strict: false,\n            success: submission.is_ok(),\n            exit_code: None,\n            stdout: String::new(),\n            stderr: String::new(),\n            duration: started.elapsed(),\n            error: submission.err().map(|failure| match failure {\n                BackgroundSupervisorFailure::Full => {\n                    \"background hook supervisor queue is full\".to_string()\n                }\n                BackgroundSupervisorFailure::Disconnected => {\n                    \"background hook supervisor is unavailable\".to_string()\n                }\n            }),\n        }\n    }\n\n    /// The timeout actually applied to a hook, foreground or background.\n    ///\n    /// `[hooks].default_timeout_secs` *replaces* the per-hook value when set;\n    /// that is the shipped behavior and is documented as such in\n    /// `docs/HOOKS.md`.\n    fn effective_timeout_secs(&self, hook: &Hook) -> u64 {\n        self.config.effective_timeout_secs(hook)\n    }\n}\n\n/// Classify a tool call for `condition = { type = \"tool_category\", … }`.","sourceCodeStart":2440,"sourceCodeEnd":2476,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/hooks/executor.rs#L2440-L2476","documentation":"A background hook could not be submitted because the background hook supervisor itself is unavailable — the submission channel is disconnected (supervisor dropped, shut down, or not started). Like the queue-full case, the failure is captured in the hook result's error field instead of crashing the executor.","triggerScenarios":"Submitting a background hook when BackgroundSupervisorFailure::Disconnected is returned: the supervisor's channel send fails because the receiver side is gone (supervisor task ended or was never spawned).","commonSituations":"Supervisor task crashed earlier (panic in a hook runner); app shutdown racing with a final hook execution; supervisor never initialized due to an earlier startup error; hot-reload of configuration tearing down and not restoring the supervisor.","solutions":["Restart the session/application so the hook supervisor is re-spawned.","Check logs for the supervisor's crash cause (panic, startup failure) and fix it.","If this occurs during shutdown, treat the lost hook as expected and move on.","Verify hook supervisor initialization in configuration and that startup errors are not silently skipped."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"let result = run_hook_background(cmd);\nif !result.success && result.error == Some(\"background hook supervisor is unavailable\".into()) {\n    log::error(\"hook supervisor down; running hook inline\");\n    run_hook_synchronously(cmd);\n}","preventionTips":["Ensure the hook supervisor is initialized before any tool execution begins.","Guard supervisor tasks against panics so one bad hook cannot kill the channel.","During shutdown, drain or skip background hooks explicitly."],"tags":["hooks","supervisor","disconnected","shutdown"],"backgroundTag":"broken-pipe","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T06:17:15.046Z"}