codex - 💡(How to fix) Fix amazon-bedrock provider: namespace_tools capability breaks Bedrock Mantle (validation_error)

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

{"error":{"code":"validation_error","message":"Failed to deserialize the JSON body into the target type: ?[13]: Invalid 'tools': unknown variant namespace, expected function or mcp at line 1 column 107773","param":null,"type":"invalid_request_error"}} This is a separate issue from the URL path bug (#23650 / #21352). Even after fixing the /openai/v1/v1 path, users with any meaningful number of tools (MCP servers, built-in shell/apply_patch, etc.) will hit this error because namespace_tools: true wraps all tool definitions in the unsupported format.

Root Cause

// codex-rs/model-provider/src/amazon_bedrock/mod.rs:58-62
fn capabilities(&self) -> ProviderCapabilities {
    ProviderCapabilities {
        namespace_tools: true,   // ← Mantle doesn't support this
        image_generation: false,
        web_search: false,
    }
}

When namespace_tools is true, core/src/tools/spec_plan.rs:876 wraps Function tools into Namespace:

ToolSpec::Function(tool) => ToolSpec::Namespace(ResponsesApiNamespace { ... })

The "namespace" tool type is an OpenAI-proprietary extension that Bedrock Mantle has not implemented.

Fix Action

Fix / Workaround

This is a separate issue from the URL path bug (#23650 / #21352). Even after fixing the /openai/v1/v1 path, users with any meaningful number of tools (MCP servers, built-in shell/apply_patch, etc.) will hit this error because namespace_tools: true wraps all tool definitions in the unsupported format.

Code Example

{"error":{"code":"validation_error","message":"Failed to deserialize the JSON body into the target type: ?[13]: Invalid 'tools': unknown variant `namespace`, expected `function` or `mcp` at line 1 column 107773","param":null,"type":"invalid_request_error"}}

---

// codex-rs/model-provider/src/amazon_bedrock/mod.rs:58-62
fn capabilities(&self) -> ProviderCapabilities {
    ProviderCapabilities {
        namespace_tools: true,   // ← Mantle doesn't support this
        image_generation: false,
        web_search: false,
    }
}

---

ToolSpec::Function(tool) => ToolSpec::Namespace(ResponsesApiNamespace { ... })

---

fn capabilities(&self) -> ProviderCapabilities {
    ProviderCapabilities {
        namespace_tools: false,  // Mantle only accepts "function" and "mcp"
        image_generation: false,
        web_search: false,
    }
}
RAW_BUFFERClick to expand / collapse

Bug

The built-in amazon-bedrock provider sets namespace_tools: true in its capabilities (mod.rs:60). This causes Codex to serialize tools using the {"type": "namespace", ...} wrapper format. However, Bedrock Mantle's Responses API schema validator only accepts "function" and "mcp" tool types, rejecting "namespace" with:

{"error":{"code":"validation_error","message":"Failed to deserialize the JSON body into the target type: ?[13]: Invalid 'tools': unknown variant `namespace`, expected `function` or `mcp` at line 1 column 107773","param":null,"type":"invalid_request_error"}}

This is a separate issue from the URL path bug (#23650 / #21352). Even after fixing the /openai/v1/v1 path, users with any meaningful number of tools (MCP servers, built-in shell/apply_patch, etc.) will hit this error because namespace_tools: true wraps all tool definitions in the unsupported format.

Reproduction

  1. Fix the Mantle URL path (per #23650) so requests actually reach the server
  2. Use the amazon-bedrock provider with default config (any registered MCP servers or built-in tools)
  3. Run codex exec "hello" → HTTP 400 validation_error about namespace

With a minimal config (no MCP, features like code_mode/multi_agent_v2 off), the namespace wrapping doesn't fire for the few remaining tools, so it works. But any real-world config triggers it.

Root Cause

// codex-rs/model-provider/src/amazon_bedrock/mod.rs:58-62
fn capabilities(&self) -> ProviderCapabilities {
    ProviderCapabilities {
        namespace_tools: true,   // ← Mantle doesn't support this
        image_generation: false,
        web_search: false,
    }
}

When namespace_tools is true, core/src/tools/spec_plan.rs:876 wraps Function tools into Namespace:

ToolSpec::Function(tool) => ToolSpec::Namespace(ResponsesApiNamespace { ... })

The "namespace" tool type is an OpenAI-proprietary extension that Bedrock Mantle has not implemented.

Suggested Fix

fn capabilities(&self) -> ProviderCapabilities {
    ProviderCapabilities {
        namespace_tools: false,  // Mantle only accepts "function" and "mcp"
        image_generation: false,
        web_search: false,
    }
}

Environment

  • Codex CLI v0.135.0
  • Bedrock Mantle all regions (us-east-1, us-west-2, etc.)
  • AWS Account with openai.gpt-oss-120b model access
  • Tested 2026-05-29

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

codex - 💡(How to fix) Fix amazon-bedrock provider: namespace_tools capability breaks Bedrock Mantle (validation_error)