Hmbown/CodeWhale · error · anyhow::Error
FIM completion is not supported for
Error message
FIM completion is not supported for {} because the route has no proven FIM wire contract ({:?}) What it means
Fill-in-the-middle (FIM) completions are only attempted through a ChatCompletions wire format and are never offered on OpenCode Zen, because those routes have no proven FIM wire contract (`beta/completions`). The client deliberately refuses rather than sending a request that would fail or silently degrade. Raised in `crates/tui/src/client.rs` around line 5109.
Solutions
- Switch the route/provider to one with ChatCompletions wire format (and not OpenCode Zen).
- Disable or bypass FIM for this provider and use a chat-based completion instead.
- If this provider genuinely supports FIM upstream, add a proven wire contract for it in the client first.
Defensive patterns
Strategy: type-guard
Validate before calling
fn fim_supported(provider: ApiProvider, wire: WireFormat) -> bool {
provider != ApiProvider::OpencodeZen && wire == WireFormat::ChatCompletions
} Type guard
fn can_fim(c: &Client) -> bool {
c.api_provider != ApiProvider::OpencodeZen && c.wire_format == WireFormat::ChatCompletions
} Try / catch
if !can_fim(&client) {
return use_chat_completion_fallback(prompt);
}
match client.fim_completion(req).await { ... } Prevention
- Check provider + wire format before offering FIM autocomplete.
- Do not enable FIM for OpenCode Zen routes.
- Gate FIM features on a supported-provider allowlist.
When it happens
Trigger: Calling the FIM completion method when `self.api_provider == ApiProvider::OpencodeZen` OR `self.wire_format != WireFormat::ChatCompletions` (e.g. an Anthropic- or Responses-wire route).
Common situations: Pointing the FIM feature at an Anthropic-style provider route; using OpenCode Zen as the active provider; a config change that switched the wire format away from ChatCompletions while FIM autocomplete remains enabled.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- account_agent_model_unconfigured
- active provider has no native web-search adapter
- atomic built-in snapshot publication is unsupported on this…
- Auto has no concrete route yet; send a turn before warming…
- Browser login is only enabled for the canonical Codewhale…
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/59cd0ce44ac6cfc7.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/client.rs:5109
_ => {}
}
}
impl CodewhaleClient {
/// Call the DeepSeek `/beta/completions` FIM endpoint.
pub async fn fim_completion(
&self,
model: &str,
prompt: &str,
suffix: &str,
max_tokens: u32,
) -> anyhow::Result<String> {
let _inference = self.acquire_remote_control_inference_permit().await;
let _permit = self.acquire_provider_request_permit().await;
if self.api_provider == ApiProvider::OpencodeZen
|| self.wire_format != WireFormat::ChatCompletions
{
bail!(
"FIM completion is not supported for {} because the route has no proven FIM wire contract ({:?})",
self.api_provider.display_name(),
self.wire_format
);
}
let url = api_url_with_suffix(&self.base_url, "beta/completions", None);
let model = self.wire_model_for_route(model);
let max_tokens = max_tokens.min(self.effective_max_output_tokens(&model));
let body = json!({
"model": model,
"prompt": prompt,
"suffix": suffix,
"max_tokens": max_tokens,
});
let response = self.send_json_with_retry(&url, &body).await?;
let status = response.status();
if !status.is_success() {
let raw_error_text = bounded_error_text(response, ERROR_BODY_MAX_BYTES).await;View on GitHub (pinned to 73e0f67d83)