Repository navigation
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
packages/contracts or packages/shared
Steps to reproduce
- Use the OpenCode provider with a Gemini model served by Vertex AI. For example, use Vercel AI Gateway with
vercel/google/gemini-4-argonand pin it to Vertex inopencode.jsonc:"provider": { "vercel": { "models": { "google/gemini-4-argon": { "options": { "gateway": { "only": ["vertex"] } } } } } }
- Start a thread on that model and send any message, for example "Reply with ok".
Expected behavior
The turn runs.
Actual behavior
The first turn fails, and Vertex AI returns HTTP 400:
Unable to submit request because `t3-code_t3_project_create` functionDeclaration `parameters.defaultModelSelection.instanceId` schema didn't specify the schema type field.
Vertex refuses the whole request when one tool parameter has no type. T3 Code attaches its MCP tools to the OpenCode session. Four of them take a model selection: t3_thread_launch, t3_thread_configure, t3_project_create and t3_project_update. In those four, provider, instanceId, model and options are {} or anyOf: [{}, {type: "null"}]. The cause is ModelSelectionSource in packages/contracts/src/modelSelection.ts, which declares all four fields as Schema.Unknown.
Google AI Studio accepts the same request. Without the Vertex pin, AI Gateway therefore falls back from Vertex to Google AI Studio and the turn runs, but on a different provider and billing account. We noticed this because our Vertex credits stopped being used.
The other 79 T3 Code MCP tools give every field a type.
Impact
Blocks work completely
Version or commit
T3 Code (Beta) desktop 0.1.0; the same schema is on main @ 1451e7c
Environment
macOS 26.2, T3 Code (Beta) desktop 0.1.0, OpenCode 1.19.3, google/gemini-4-argon through Vercel AI Gateway restricted to Vertex AI
Logs or stack traces
GatewayInternalServerError: Unable to submit request because `t3-code_t3_project_create` functionDeclaration `parameters.defaultModelSelection.options` schema didn't specify the schema type field. Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-callingScreenshots, recordings, or supporting files
No response
Workaround
Drop the four tools from Gemini requests before they leave OpenCode, for example with an OpenCode plugin. Or use Google AI Studio instead of Vertex AI.
Activity
BilalAtique commentedon Oct 19, 2026
Fix proposed in #21656: it gives the four
ModelSelectionSourcefields JSON Schema types, and decoding accepts the same inputs as before.juliusmarminge commentedon Oct 19, 2026
Note
Grok responding on behalf of Julius.
Confirmed on main, so this is accepted as a bug.
ModelSelectiondecodes from a loose source struct whoseprovider,instanceId,modelandoptionsfields are allSchema.Unknown(modelSelection.ts:15-20). It then converts that into a typed wire shape (modelSelection.ts:9-13 and 22-50). MCP tools advertiseTool.getJsonSchemaof their parameters as-is, with no normalizing step (McpHttpServer.ts:470 and 656). So the encoded side, with its untyped fields, is what clients see. This affectst3_thread_launch(project/tools.ts:117),t3_thread_configure(thread/tools.ts:198), andt3_project_createandt3_project_update, throughdefaultModelSelection(project.ts:189 and 197).{}is valid JSON Schema, and Vertex rejecting it is a strictness of Vertex, but these are schemas T3 Code advertises. Google AI Studio accepting the same request, as you noted, is the current workaround.juliusmarminge commentedon Oct 21, 2026
Triage on Linux at main 70e5e384da: the four
ModelSelectionSourcefields still useSchema.Unknown. This is source inspection, not a live Vertex reproduction. No duplicate found in the open-issue scan for Vertex, schema type, model selection, and the reported error. The existing fix PR #21656 remains open. Stopping automated implementation because changing the advertised MCP tool schema requires maintainer handling under this triage flow. Leaving the issue open.juliusmarminge commentedon Oct 22, 2026
Fresh triage under the revised brief: the previous MCP-surface stop no longer applies. On Linux at main 8acbefefc5, OpenCode 1.18.18 has zero configured credentials. Running
opencode run --model vercel/google/gemini-4-argon "Reply with ok"failed before reaching Vertex withUnknownError, referenceerr_9062e17c. No AI Gateway or Google credentials are configured here, so this is not a live reproduction of the reported rejection. The source still has the four unknown fields. Existing fix #21656 is preserved; leaving both open. No additional reporter information is needed.thiwa8 commentedon Oct 22, 2026
Same failure with OpenCode's built-in
google-vertexprovider and a service account (no gateway), on T30.1.2-nightly.20261021.3473with OpenCode1.19.3:opencode run -m google-vertex/gemini-4-argon "Reply OK"outside T3, with the same credentials andGOOGLE_CLOUD_LOCATION=global, succeeds.Unable to submit request because `t3-code_t3_project_create` functionDeclaration `parameters.defaultModelSelection.options` schema didn't specify the schema type field.(the reported field varies betweenoptions,providerandinstanceId).Workarounds that did not help, in case it matters for the fix or a stopgap:
"tools": {"t3-code_*": false}in the OpenCode config file (OPENCODE_CONFIG).OPENCODE_CONFIG_CONTENTin the provider instance environment, also with"mcp": {"t3-code": {"enabled": false}}.T3 attaches its MCP tools either way, so the only way to use Gemini on Vertex from a T3 thread today is #21656. A per-instance option to not attach T3's MCP tools would also unblock headless agents that don't need them.