What this thread does
Do first: Upgrade CrewAI to 1.15.19 (released 2026-09-04).
Symptom
Requests ending with a model turn are not supported. appears inside Gemini's 400 INVALID_ARGUMENT response when CrewAI retries after an assistant turn. GitHub reporter hvlcrs describes it in #6984, with the same report also filed as #6972. The report names CrewAI 1.6.0; it does not establish a complete affected-version range.
Cause
PR #6973 explains that the native Gemini formatter translated assistant messages into Gemini model turns without checking the final turn. Maximum-iteration handling or a guardrail retry could therefore send Gemini a history ending on a model turn. The PR also identifies a missing Gemini guard in the LiteLLM fallback formatter.
Fix
1. Upgrade to CrewAI 1.15.19, whose release notes list the trailing-user-turn correction. 2. For the native provider, the correction in GeminiCompletion._format_messages_for_gemini appends a user types.Content when the formatted history ends on a model turn. No extra setting is specified. 3. For the LiteLLM fallback, the same PR adds Gemini handling in LLM._format_messages_for_provider. The PR identifies this route when google-genai is absent or the model name is not recognized as native.
Fixed in
Fixed in 1.15.19 (released 2026-09-04). PR #6973 merged on 2026-09-03. The tag comparison places its merge commit inside 1.15.19 and after 1.15.18.
If it still fails
- This correction handles histories ending on a model turn; the PR does not claim to resolve every Gemini
INVALID_ARGUMENTresponse. - The source does not establish a workaround for every retry path before the release.
Not for: Gemini model-retired errors in CrewAI, or CrewAI setups on other providers.
Sources
- [[BUG] Gemini native provider never appends trailing user turn -> 400 'Requests ending with a model turn are not supported'](https://github.com/crewAIInc/crewAI/issues/6984), hvlcrs, opened 2026-08-13; closed as completed on 2026-09-03: "Requests ending with a model turn are not supported."
- Same symptom, earlier report #6972, hvlcrs, opened 2026-08-12; closed as completed on 2026-08-13.
- fix: append trailing user turn in native Gemini provider, hvlcrs; merged 2026-09-03 (closed).
- 1.15.19, published 2026-09-04.
- 1.15.18 to fix merge commit: merge commit is ahead of this tag.
- 1.15.19 to fix merge commit: merge commit is behind this tag.
Checked
2026-11-24; read GitHub API records for issues #6984 and #6972 and their comments, PR #6973, release 1.15.19, and both tag comparisons; no command was run.
Started from a post by @hvlcrs, packaged by the editor. Original post