{"record":{"id":"8d966265794a998f","repo":"Hmbown/CodeWhale","slug":"the-selected-runtime-model-does-not-support-maxoutputtokens","errorCode":null,"errorMessage":"The selected Runtime model does not support maxOutputTokens","messagePattern":"The selected Runtime model does not support maxOutputTokens","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/app-server/src/lib.rs","lineNumber":1682,"sourceCode":"            url.query_pairs_mut().append_pair(\"limit\", \"250\");\n            if let Some(cursor) = cursor.as_deref() {\n                url.query_pairs_mut().append_pair(\"cursor\", cursor);\n            }\n            let catalog = self.request_json(self.authed(self.client.get(url))).await?;\n            if let Some(entry) =\n                catalog\n                    .get(\"models\")\n                    .and_then(Value::as_array)\n                    .and_then(|models| {\n                        models\n                            .iter()\n                            .find(|entry| entry.get(\"id\").and_then(Value::as_str) == Some(model))\n                    })\n            {\n                if entry.get(\"output_token_limit\").and_then(Value::as_str) == Some(\"supported\") {\n                    return Ok(());\n                }\n                bail!(\"The selected Runtime model does not support maxOutputTokens\");\n            }\n            let next = catalog\n                .get(\"nextCursor\")\n                .and_then(Value::as_str)\n                .context(\"Output-limit support is unknown for the selected Runtime model\")?;\n            if !seen.insert(next.to_string()) {\n                bail!(\"Runtime model catalog cursor repeated\");\n            }\n            cursor = Some(next.to_string());\n        }\n    }\n\n    /// Resolve `stdio_thread_id` to a runtime thread, minting one only when\n    /// `thread_map` has no entry. The map lives on [`AppState`] and outlives\n    /// this bridge, so a thread created under a previous child keeps its id\n    /// here as long as the store it was persisted to is shared (#6246).\n    async fn ensure_runtime_thread(\n        &mut self,","sourceCodeStart":1664,"sourceCodeEnd":1700,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/app-server/src/lib.rs#L1664-L1700","documentation":"While paging the Runtime model catalog to confirm the selected model supports `maxOutputTokens`, the model entry was found but its `output_token_limit` is not \"supported\" (e.g. \"unsupported\" or absent). The requested output-token cap cannot be honored for that model.","triggerScenarios":"The catalog page containing the selected model id has `entry[\"output_token_limit\"] != \"supported\"` while resolving maxOutputTokens.","commonSituations":"Using a model that has no output-token-limit support (older or constrained models) and passing maxOutputTokens with the request.","solutions":["Remove `maxOutputTokens` from the request for this model.","Select a model whose catalog entry reports `output_token_limit: \"supported\"`.","Upgrade the Runtime/provider if support for the model was expected."],"exampleFix":"// before\n{ \"model\": \"legacy-mini\", \"maxOutputTokens\": 512 }\n// after\n{ \"model\": \"qwen3-coder\" }","handlingStrategy":"fallback","validationCode":"// check capability before requesting a token cap\nconst entry = catalog.models.find(m => m.id === model);\nconst supportsCap = entry && entry.output_token_limit === 'supported';\nconst payload = supportsCap ? { model, maxOutputTokens: cap } : { model };","typeGuard":"function supportsOutputTokenLimit(entry) {\n  return !!entry && entry.output_token_limit === 'supported';\n}","tryCatchPattern":"// fall back to an uncapped request\nmatch send_with_cap(model, cap).await {\n    Err(e) if e.to_string().contains(\"does not support maxOutputTokens\") => {\n        send_without_cap(model).await\n    }\n    other => other,\n}","preventionTips":["Consult the model catalog before offering maxOutputTokens in your UI/client.","Maintain a known-supported model list for token caps.","Upgrade the Runtime if a model should support caps but reports otherwise."],"tags":["api","model","unsupported-operation","runtime"],"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"}