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
`rebound_for_model_protocol` handles providers whose wire policy is `ModelAware` — different models on the same provider can speak different wire protocols (OpenAI Responses vs Anthropic Messages vs ChatCompletions). When the central route resolver maps the requested model to a protocol different from the client's construction-time `wire_format`, the client must be rebuilt via `Self::from_candidate(config, ...)`. This error fires when a rebind is required but the caller passed `config: None`, so there is nothing to rebuild from. In practice this is hit from the subagent runtime (`tools/subagent/mod.rs`), which passes `child_runtime.api_config`.
Source
Thrown at crates/tui/src/client.rs:1290
if !model_aware {
return Ok(None);
}
static RESOLVER: OnceLock<RouteResolver> = OnceLock::new();
let candidate = RESOLVER
.get_or_init(RouteResolver::new)
.resolve(&RouteRequest {
explicit_provider: self.api_provider.kind(),
model_selector: Some(LogicalModelRef::from(model)),
saved_provider_model: None,
base_url_override: Some(self.base_url.clone()),
limit_overrides: Vec::new(),
})
.map_err(anyhow::Error::msg)?;
if candidate.protocol() == self.wire_format {
return Ok(None);
}
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> {
let model_aware = self.api_provider.metadata().is_some_and(|provider| {
provider.wire_policy() == codewhale_config::provider::WirePolicy::ModelAware
});
if !model_aware {
return Ok(request);
}
View on GitHub (pinned to 8880682c63)
Solutions
- Ensure the runtime executing the model carries the loaded configuration (pass the `Config` through so `rebound_for_model_protocol` receives `Some(config)`).
- As a workaround, pin the subagent/child model to one whose resolved protocol matches the client's existing wire binding, so no rebind is needed.
- If you control the provider definition, avoid mixing wire protocols under one ModelAware provider, or verify the model-to-protocol mapping in the route resolver configuration.
Example fix
// before let client = client.rebound_for_model_protocol(None, &model)?; // after let client = client.rebound_for_model_protocol(Some(&config), &model)?;
Defensive patterns
Strategy: fallback
Validate before calling
// Before selecting a cross-protocol model for a child runtime, ensure a Config is available.
if client_needs_rebind(provider, model)? && child_runtime.api_config.is_none() {
// fall back to the parent's current model instead of failing the send
effective_model = parent_model.clone();
} Type guard
fn is_model_aware(provider: ApiProvider) -> bool {
provider.metadata().is_some_and(|m| m.wire_policy() == WirePolicy::ModelAware)
} Try / catch
match client.rebound_for_model_protocol(config.as_ref(), &model) {
Ok(Some(rebound)) => use(rebound),
Ok(None) => use(client), // already correct binding
Err(e) if e.to_string().contains("no configuration is available") => {
// degrade gracefully: keep the existing binding / parent model
fall_back_to_parent_binding();
}
Err(e) => return Err(e),
} Prevention
- Always thread the loaded `Config` into child runtimes (`child_runtime.api_config = Some(config)`).
- When offering model pickers for ModelAware providers, annotate which models switch wire protocols.
- Smoke-test subagent launches after adding new models to a ModelAware provider definition.
When it happens
Trigger: Launching a subagent (or any code path calling `rebound_for_model_protocol(None, model)`) whose effective model resolves to a different wire protocol than the parent client's binding — e.g. a ModelAware provider where model A is chat-completions and model B is responses — while the child runtime was created without an `api_config`.
Common situations: Custom ModelAware provider definitions where a subagent's model selector crosses protocol families; a programmatic embedding that constructs a client and calls subagent tooling without threading the loaded `Config` through; version drift where an older caller site was not yet updated to pass the config.
Related errors
- auto-route classifier response incomplete: provider stop rea
- parallel(): expected an array of thunks
- Codewhale terminal receipt did not use provider openai
- budget document_kind must be {BUDGET_KIND}
- budget fixture no longer matches the frozen workload
AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16).
Data as JSON: /api/errors/9eb41326fbd2c569.
Report an issue: GitHub.