{"record":{"id":"3219ffff2fdb5de4","repo":"Hmbown/CodeWhale","slug":"dynamic-tool-call-is-already-pending","errorCode":null,"errorMessage":"Dynamic tool call '{}' is already pending","messagePattern":"Dynamic tool call '(.+?)' is already pending","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/runtime_threads.rs","lineNumber":5490,"sourceCode":"                .then_with(|| left.id.cmp(&right.id))\n        });\n        (approvals, user_inputs)\n    }\n\n    fn register_pending_dynamic_tool(\n        &self,\n        params: DynamicToolCallParams,\n    ) -> Result<oneshot::Receiver<DynamicToolCallResult>> {\n        let (tx, rx) = oneshot::channel();\n        let (settlement_tx, _settlement_rx) = watch::channel(0);\n        let mut pending = self.pending_dynamic_tools.lock();\n        if pending.len() >= MAX_PENDING_DYNAMIC_TOOL_CALLS {\n            bail!(\n                \"Runtime has reached the pending dynamic tool call limit ({MAX_PENDING_DYNAMIC_TOOL_CALLS})\"\n            );\n        }\n        if pending.contains_key(&params.call_id) {\n            bail!(\"Dynamic tool call '{}' is already pending\", params.call_id);\n        }\n        pending.insert(\n            params.call_id.clone(),\n            PendingDynamicToolEntry {\n                params,\n                sender: Some(tx),\n                settlement_tx,\n                indeterminate: false,\n            },\n        );\n        Ok(rx)\n    }\n\n    /// Atomically select the single terminal owner for a dynamic tool call.\n    ///\n    /// The registry entry intentionally remains present with an empty sender\n    /// while the winner commits its receipt. `get_thread_detail` therefore\n    /// cannot publish a cursor that has neither the pending request nor the","sourceCodeStart":5472,"sourceCodeEnd":5508,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/runtime_threads.rs#L5472-L5508","documentation":"register_pending_dynamic_tool found the call id already registered as pending; each dynamic tool call may be registered exactly once per turn, so a duplicate registration (double delivery or a retried event) is refused to preserve exactly-one-settlement semantics.","triggerScenarios":"Thrown at crates/tui/src/runtime_threads.rs:5490 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Wait for a pending dynamic tool call with the same id to settle before registering a new one.","Deliver or cancel the outstanding dynamic tool call to free a slot under MAX_PENDING_DYNAMIC_TOOL_CALLS."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}