Skip to content

Bedrock Exception: name: Extra inputs are not permitted #2038

@wreed4

Description

@wreed4

I am trying to use a Bedrock model behind a LiteLLM proxy. This configuration works well for the built-in plan and build agents in opencode, but when I try to create a custom agent, I can't make any calls using that agent without getting the following error.

AI_APICallError: litellm.BadRequestError: BedrockException - {"message":"The model returned the following errors: name: Extra inputs are not permitted"}. Received Model Group=anthropic.claude-sonnet-4                 ┃
  ┃  Available Model Group Fallbacks=None  

I asked opencode to analyze the opencode codebase for this problem (full disclosure) And it's claiming the following:


Perfect! Here's the custom agent parsing flow:

Custom Agent Config Reading and Parsing

Location: /home/wreed/Documents/opencode/packages/opencode/src/config/config.ts:46-80

Step-by-step process:

  1. File Discovery (config.ts:46-49):

    const markdownAgents = [
      ...(await Filesystem.globUp("agent/**/*.md", Global.Path.config, Global.Path.config)),
      ...(await Filesystem.globUp(".opencode/agent/**/*.md", app.path.cwd, app.path.root)),
    ]

    Searches for *.md files in agent/ and .opencode/agent/ directories

  2. YAML Frontmatter Parsing (config.ts:51-53):

    const content = await Bun.file(item).text()
    const md = matter(content)  // This parses YAML frontmatter
    if (!md.data) continue

    Uses the matter library to extract YAML frontmatter from markdown files

  3. Agent Name Extraction (config.ts:55-68):
    Derives agent name from file path and handles nested folders

  4. Config Object Creation (config.ts:70-74):

    const config = {
      name: agentName,        // ← This adds the "name" field!
      ...md.data,            // ← Your YAML frontmatter (including reasoningEffort)  
      prompt: md.content.trim(),
    }
  5. Processing in Agent Module (agent.ts:103-107):

    const { model, prompt, tools, description, temperature, top_p, mode, permission, ...extra } = value
    item.options = {
      ...item.options,
      ...extra,  // Both "name" and "reasoningEffort" end up here!
    }

The Issue

The config parsing adds a name field (config.ts:71) that gets included in the ...extra spread along with your reasoningEffort field. Both of these end up in agent.options and get passed to the AI SDK, which LiteLLM then forwards to Bedrock, causing the "Extra inputs not permitted" error.

Built-in agents don't go through this YAML parsing, so they don't have these extra fields.


Namely, it's seeing that we're adding a "name" field to the config which later ends up getting passed to agent.options.

Can someone with some more experience in this codebase vet this diagnosis?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions