Hmbown/CodeWhale · error

Dynamic tool call ' ' is already pending

Error message

Dynamic tool call '{}' is already pending

What it means

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.

Solutions

  1. Wait for a pending dynamic tool call with the same id to settle before registering a new one.
  2. Deliver or cancel the outstanding dynamic tool call to free a slot under MAX_PENDING_DYNAMIC_TOOL_CALLS.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/tui/src/runtime_threads.rs:5490 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/3219ffff2fdb5de4. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/runtime_threads.rs:5490

                .then_with(|| left.id.cmp(&right.id))
        });
        (approvals, user_inputs)
    }

    fn register_pending_dynamic_tool(
        &self,
        params: DynamicToolCallParams,
    ) -> Result<oneshot::Receiver<DynamicToolCallResult>> {
        let (tx, rx) = oneshot::channel();
        let (settlement_tx, _settlement_rx) = watch::channel(0);
        let mut pending = self.pending_dynamic_tools.lock();
        if pending.len() >= MAX_PENDING_DYNAMIC_TOOL_CALLS {
            bail!(
                "Runtime has reached the pending dynamic tool call limit ({MAX_PENDING_DYNAMIC_TOOL_CALLS})"
            );
        }
        if pending.contains_key(&params.call_id) {
            bail!("Dynamic tool call '{}' is already pending", params.call_id);
        }
        pending.insert(
            params.call_id.clone(),
            PendingDynamicToolEntry {
                params,
                sender: Some(tx),
                settlement_tx,
                indeterminate: false,
            },
        );
        Ok(rx)
    }

    /// Atomically select the single terminal owner for a dynamic tool call.
    ///
    /// The registry entry intentionally remains present with an empty sender
    /// while the winner commits its receipt. `get_thread_detail` therefore
    /// cannot publish a cursor that has neither the pending request nor the

View on GitHub (pinned to 73e0f67d83)