{"record":{"id":"59cd0ce44ac6cfc7","repo":"Hmbown/CodeWhale","slug":"fim-completion-is-not-supported-for-because-the","errorCode":null,"errorMessage":"FIM completion is not supported for {} because the route has no proven FIM wire contract ({:?})","messagePattern":"FIM completion is not supported for (.+?) because the route has no proven FIM wire contract \\((.+?)\\)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/client.rs","lineNumber":5109,"sourceCode":"        _ => {}\n    }\n}\n\nimpl CodewhaleClient {\n    /// Call the DeepSeek `/beta/completions` FIM endpoint.\n    pub async fn fim_completion(\n        &self,\n        model: &str,\n        prompt: &str,\n        suffix: &str,\n        max_tokens: u32,\n    ) -> anyhow::Result<String> {\n        let _inference = self.acquire_remote_control_inference_permit().await;\n        let _permit = self.acquire_provider_request_permit().await;\n        if self.api_provider == ApiProvider::OpencodeZen\n            || self.wire_format != WireFormat::ChatCompletions\n        {\n            bail!(\n                \"FIM completion is not supported for {} because the route has no proven FIM wire contract ({:?})\",\n                self.api_provider.display_name(),\n                self.wire_format\n            );\n        }\n        let url = api_url_with_suffix(&self.base_url, \"beta/completions\", None);\n        let model = self.wire_model_for_route(model);\n        let max_tokens = max_tokens.min(self.effective_max_output_tokens(&model));\n        let body = json!({\n            \"model\": model,\n            \"prompt\": prompt,\n            \"suffix\": suffix,\n            \"max_tokens\": max_tokens,\n        });\n        let response = self.send_json_with_retry(&url, &body).await?;\n        let status = response.status();\n        if !status.is_success() {\n            let raw_error_text = bounded_error_text(response, ERROR_BODY_MAX_BYTES).await;","sourceCodeStart":5091,"sourceCodeEnd":5127,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/client.rs#L5091-L5127","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"fn fim_supported(provider: ApiProvider, wire: WireFormat) -> bool {\n    provider != ApiProvider::OpencodeZen && wire == WireFormat::ChatCompletions\n}","typeGuard":"fn can_fim(c: &Client) -> bool {\n    c.api_provider != ApiProvider::OpencodeZen && c.wire_format == WireFormat::ChatCompletions\n}","tryCatchPattern":"if !can_fim(&client) {\n    return use_chat_completion_fallback(prompt);\n}\nmatch client.fim_completion(req).await { ... }","preventionTips":["Check provider + wire format before offering FIM autocomplete.","Do not enable FIM for OpenCode Zen routes.","Gate FIM features on a supported-provider allowlist."],"tags":["fim","unsupported","routing"],"backgroundTag":"unsupported-operation","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"}