Skip to content

[Provider] Vertex AI rejects tool-result images with model-turn 400 on gemini-4-neon and gemini-3.8-flash (plus missing gemini-4-neon registry entry) #8969

Closed

Description

@hirorylabo

Client or integration

Codex App

Provider or upstream service

google-vertex (Google Vertex AI — gemini-4-neon, gemini-3.8-flash)

OpenCodex version

2.100.5 (same 3-model allowlist and missing gemini-4-neon registry entry are still present on dev at 6a4ae9d6)

Endpoint or capability

POST /v1/responses translated to Vertex AI :streamGenerateContent / :generateContent with tool-result images (input_image inside custom_tool_call_output / function_call_output), plus google / google-vertex built-in registry metadata for gemini-4-neon

Current behaviour

  1. When a tool call returns an image (for example exec emitting PNG/WebP input_image blocks or view_image), the immediately following Vertex AI request fails with HTTP 400 (Requests ending with a model turn are not supported.) on models outside the hardcoded 3-model allowlist (gemini-4-argon, gemini-4-carbon, gemini-4-hydrogen):
    • google-vertex/gemini-4-neon (2026-11-20, ocx 2.100.5, location: "global"): text-only tool turns succeeded in the same thread; the first turn whose custom_tool_call_output contained 3 input_image parts (1 PNG + 2 WebP) failed immediately with HTTP 400. A follow-up user message afterward allowed the thread to continue with the same image tool output in history.
    • google-vertex/gemini-3.8-flash (2026-10-22): identical HTTP 400 on Vertex AI.
  2. gemini-4-neon (GA 2026-11-18) is also absent from GEMINI_MODEL_REASONING_EFFORTS, GEMINI_MODEL_DEFAULT_REASONING_EFFORTS, modelContextWindows, modelInputModalities in src/providers/registry/entries-core.ts, and scripts/model-metadata.source.json.

Expected behaviour

  1. Vertex AI Gemini 3+ models (including gemini-3.8-flash, gemini-4-neon, and future live-discovered gemini-4-* models via feat(google-vertex): support live Publisher Models discovery, gemini-4-carbon, and gemini-4-hydrogen #8583) should nest matched tool-result images inside functionResponse.parts and separate image-bearing orphan batches, matching ADR-7279.
  2. gemini-4-neon should be registered in the shared Google / Vertex registry tables and generated model metadata with its documented capabilities (low/medium/high [default]/xhigh, 1,048,576 context window, 65,536 max output tokens, ["text", "image"]).

Minimal redacted request or reproduction

# Reproduce through OpenCodex with google-vertex/gemini-4-neon (or gemini-3.8-flash):
# 1. Start a Codex App turn using google-vertex/gemini-4-neon.
# 2. Run a tool that returns text + input_image (PNG/WebP data URL) in custom_tool_call_output / function_call_output.
# 3. OpenCodex translates the trailing tool result as:
#    {"role":"user","parts":[
#      {"functionResponse":{"name":"exec","id":"call_...","response":{"result":"..."}}},
#      {"inline_data":{"mime_type":"image/png","data":"<base64>"}}
#    ]}
#    and Vertex AI returns HTTP 400:
#    "Requests ending with a model turn are not supported."
#
# Moving inline_data into functionResponse.parts (ADR-7279 / #7280 / #8583) matches
# Google's documented multimodal function-response format for Gemini 3+.

Actual response or error

HTTP 400 Bad Request
{"error":{"message":"Provider error 400: Vertex AI invalid request: Requests ending with a model turn are not supported.","type":"upstream_error","code":null}}

# Observed in usage.jsonl (redacted):
# 1) 2026-10-22 | provider=google-vertex | model=gemini-3.8-flash | status=400 | failureCause=payload-rejected
#    upstreamError: "Provider error 400: Vertex AI invalid request: Requests ending with a model turn are not supported."
# 2) 2026-11-20 | provider=google-vertex | model=gemini-4-neon    | status=400 | failureCause=payload-rejected
#    client=codex_desktop | requestBody.decodedBytes=891109 (3 inline images in trailing custom_tool_call_output)

Upstream documentation

Suggested mapping or implementation notes

  • src/adapters/google.ts: replace the 3-model check on provider.googleMode === "vertex" with /^gemini-(?:[3-9]|\d{2,})(?:[.-]|$)/i.test(parsed.modelId).
  • src/providers/registry/entries-core.ts and scripts/model-metadata.source.json (plus bun run generate:model-metadata): add gemini-4-neon with ["low", "medium", "high", "xhigh"], default "high", 1,048,576 context, 65,536 max output, and ["text", "image"].
  • Update structure/decisions/ADR-7279-vertex-argon-tool-images.md, structure/providers/google.md, docs-site guides, and Vertex adapter/catalog tests.

Additional context and attachments

Related: #7279, #7280, #8583.
Workaround: use google-vertex/gemini-4-hydrogen for image-heavy tool turns.
Environment: macOS arm64, Codex App (codex-cli 0.169.1), OpenCodex 2.100.5.

Checks

  • I searched existing provider and compatibility issues.
  • The request and response were redacted.
  • The expected behaviour is based on an upstream specification or a concrete client requirement.

Activity

  1. coderabbitai commented on Nov 19, 2026

    @coderabbitai
    Contributor
    🔗 Related PRs

    #8583 - feat(google-vertex): support live Publisher Models discovery, gemini-4-carbon, and gemini-4-hydrogen [merged]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  2. added
    provider-compatibility
    provider
    tools
    on Nov 19, 2026
  3. lidge-jun commented on Nov 20, 2026

    @lidge-jun
    Owner

    Fixed by #8970, squash-merged into dev as efd711e.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    providerprovider-compatibilitytools

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions