Hmbown/CodeWhale · error
{} model {:?} uses {:?}, but this client is bound to {:?} an
Error message
{} model {:?} uses {:?}, but this client is bound to {:?} and no configuration is available to rebuild it What it means
A model switch was requested on a client bound to a different wire protocol. The new model needs a rebuilt transport, but no configuration is available in this (typically embedded/test) runtime to reconstruct the endpoint and credentials, so the switch is refused.
Source
Thrown at crates/tui/src/client.rs:1318
if candidate.protocol() == self.wire_format
&& candidate.wire_model_id().as_str() == self.default_model
&& candidate_limits == self.route_limits
{
return Ok(None);
}
if candidate.protocol() == self.wire_format {
// Same-protocol model switches keep the already-authenticated,
// endpoint-bound transport but must freeze the alternate model's
// exact wire identity and limits. This path is also what makes a
// model-aware client usable in embedded/test runtimes that do not
// retain the original Config after construction.
let mut rebound = self.clone();
rebound.default_model = candidate.wire_model_id().as_str().to_string();
rebound.route_limits = candidate_limits;
return Ok(Some(rebound));
}
let config = config.ok_or_else(|| {
anyhow::anyhow!(
"{} model {:?} uses {:?}, but this client is bound to {:?} and no configuration is available to rebuild it",
self.api_provider.display_name(),
model,
candidate.protocol(),
self.wire_format
)
})?;
Self::from_candidate(config, &candidate).map(Some)
}
fn bind_request_to_protocol(
&self,
mut request: MessageRequest,
) -> Result<(MessageRequest, Option<RouteLimits>)> {
let model_aware = self.api_provider.metadata().is_some_and(|provider| {
provider.wire_policy() == codewhale_config::provider::WirePolicy::ModelAware
});
if !model_aware && request.model.trim() == self.default_model {View on GitHub (pinned to 0c42157ee5)
Solutions
- Create a client bound to the requested model's protocol instead of switching in place
- Supply configuration for the alternate model so the transport can be rebuilt
- In embedded/test runtimes, construct a fresh client per protocol
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at crates/tui/src/client.rs:1318 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20).
Data as JSON: /api/errors/9eb41326fbd2c569.
Report an issue: GitHub.