Skip to content

Vertex AI: BadRequestError 'instructions: Extra inputs are not permitted' when running agents #4282

@Ipolo92

Description

@Ipolo92

Description

When running agents (using the Task tool) with Vertex AI (Google Cloud), OpenCode crashes with the following error:

litellm.BadRequestError: Vertex_aiException BadRequestError - b'{"type":"error","error":{"type":"invalid_request_error","message":"instructions: Extra inputs are not permitted"},"request_id":"req_vrtx_011CV5YEZHNBbDtN3P12S1cH"}'. Received Model Group=claude-sonnet-4-5 Available Model Group Fallbacks=None

Configuration

{
    "provider": "vertex",
    "vertexProjectId": "<my-project-id>",
    "vertexRegion": "europe-west1",
    "model": "claude-sonnet-4-5@20250514"
}

Root Cause

Vertex AI's Anthropic API implementation doesn't support the instructions parameter that LiteLLM is trying to send when OpenCode spawns sub-agents via the Task tool. This is similar to issue #2038 which occurred with Bedrock.

The main OpenCode agent works fine, but whenever a sub-agent is created (e.g., when using the Task tool), the request includes an instructions field that Vertex AI rejects.

Expected Behavior

Agents should work seamlessly with Vertex AI just like the main OpenCode instance does.

Actual Behavior

Sub-agents fail immediately with the "Extra inputs are not permitted" error, causing OpenCode to crash.

Environment

  • Provider: Google Vertex AI
  • Model: claude-sonnet-4-5@20250514
  • Region: europe-west1
  • OpenCode version: Latest (as of Nov 2025) => 1.0.62

Suggested Fix

Similar to how the main agent request is formatted for Vertex AI compatibility, sub-agent requests should also avoid sending unsupported parameters like instructions when using Vertex AI as the provider.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions