openclaw - ✅(Solved) Fix [Bug]: Tool JSON Schema patternProperties causes 400 errors on BytePlus Ark (doubao) — schema cleaning should be universal, not provider-specific [2 pull requests, 1 participants]

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…
GitHub stats
openclaw/openclaw#57443Fetched 2026-04-08 01:49:36
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
cross-referenced ×2referenced ×2

normalizeToolParameters() only strips patternProperties (and other JSON Schema-only keywords) for Google/Gemini providers via cleanSchemaForGemini(). BytePlus Ark (doubao-seed, doubao-pro, etc.) also rejects patternProperties with HTTP 400, but is not covered by the cleaning logic.

This is the same class of bug as #19860 (which fixed it for Google Cloud Code Assist / Antigravity), but affecting a different provider.

Root Cause

In normalizeToolParameters():

const isGeminiProvider = options?.modelProvider?.toLowerCase().includes("google")
    || options?.modelProvider?.toLowerCase().includes("gemini");

function applyProviderCleaning(s) {
  if (isGeminiProvider && !isAnthropicProvider) return cleanSchemaForGemini(s);
  return s;  // All other providers get raw schema — including Ark
}

The schema cleaning is provider-specific (only Google/Gemini), but the problem is universal — any OpenAI-compatible provider that doesn't support full JSON Schema keywords will fail.

PR fix notes

PR #57480: fix(tools): strip patternProperties for all non-Anthropic providers

Description (problem / solution / changelog)

Summary

Fixes #57443

  • normalizeToolParameters() only cleaned patternProperties for Google/Gemini providers via cleanSchemaForGemini()
  • Many OpenAI-compatible providers (BytePlus Ark/doubao, etc.) also reject patternProperties with HTTP 400
  • Now patternProperties is stripped by default for all non-Anthropic providers, since Anthropic's native API is the only one that fully supports JSON Schema draft 2020-12

Changes

  • src/agents/pi-tools.schema.ts: Build a baseUnsupported keyword set that includes patternProperties for all non-Anthropic providers, merged with any explicit modelCompat.unsupportedToolSchemaKeywords
  • src/agents/pi-tools.schema.test.ts: Add test verifying patternProperties is stripped for non-Anthropic providers but preserved for Anthropic

Test plan

  • 2 unit tests pass (pi-tools.schema.test.ts)
  • Manual: configure BytePlus Ark provider, send a message that triggers exec tool, verify no HTTP 400

🤖 Generated with Claude Code

Changed files

  • src/agents/pi-tools.schema.test.ts (modified, +41/-0)
  • src/agents/pi-tools.schema.ts (modified, +10/-2)

PR #57539: fix: apply schema cleaning for Ark/Volcengine/BytePlus providers

Description (problem / solution / changelog)

Problem

Ark API (used by Volcengine/BytePlus/Ark providers) rejects the patternProperties JSON Schema keyword with HTTP 400:

HTTP 400: Invalid decoding guidance syntax: Keyword 'patternProperties' is not supported
for type 'object' at path '$.properties.env'

This affects any tool that uses patternProperties in its schema (e.g., exec tool's env parameter).

Root Cause

applyProviderCleaning() in pi-tools.schema.ts only calls cleanSchemaForGemini() for Google/Gemini providers. Ark-family providers have the same restriction but are not covered.

Fix

Add isArkProvider detection matching volcengine, volcengine-plan, byteplus, byteplus-plan, and ark provider IDs. Apply the same cleanSchemaForGemini() cleaning to these providers.

The regex also handles the ark/model-name format with an optional trailing slash.

Changes

  • src/agents/pi-tools.schema.ts: Add isArkProvider variable and extend the condition in applyProviderCleaning() from isGeminiProvider to (isGeminiProvider || isArkProvider).

Testing

  1. Configure a Volcengine/Ark provider with a doubao model
  2. Send a message that triggers exec tool usage
  3. Before fix: HTTP 400 with patternProperties error
  4. After fix: Tool schema cleaned, API call succeeds

Fixes #57443

Changed files

  • src/agents/pi-tools.schema.ts (modified, +6/-1)

Code Example

{
  "env": {
    "patternProperties": {
      "^(.*)$": { "type": "string" }
    },
    "type": "object"
  }
}

---

const isGeminiProvider = options?.modelProvider?.toLowerCase().includes("google")
    || options?.modelProvider?.toLowerCase().includes("gemini");

function applyProviderCleaning(s) {
  if (isGeminiProvider && !isAnthropicProvider) return cleanSchemaForGemini(s);
  return s;  // All other providers get raw schema — including Ark
}
RAW_BUFFERClick to expand / collapse

Summary

normalizeToolParameters() only strips patternProperties (and other JSON Schema-only keywords) for Google/Gemini providers via cleanSchemaForGemini(). BytePlus Ark (doubao-seed, doubao-pro, etc.) also rejects patternProperties with HTTP 400, but is not covered by the cleaning logic.

This is the same class of bug as #19860 (which fixed it for Google Cloud Code Assist / Antigravity), but affecting a different provider.

Steps to reproduce

  1. Configure a model provider using BytePlus Ark API (e.g. doubao-seed-2-0-pro-260215)
  2. Ensure the agent has exec tool enabled
  3. Send any message that triggers tool use

Expected behavior

Tool calls are sent to the API and processed normally.

Actual behavior

API returns HTTP 400 because exec tool's env parameter schema contains patternProperties:

{
  "env": {
    "patternProperties": {
      "^(.*)$": { "type": "string" }
    },
    "type": "object"
  }
}

BytePlus Ark API does not support patternProperties in tool parameter schemas and rejects the entire request.

Root cause

In normalizeToolParameters():

const isGeminiProvider = options?.modelProvider?.toLowerCase().includes("google")
    || options?.modelProvider?.toLowerCase().includes("gemini");

function applyProviderCleaning(s) {
  if (isGeminiProvider && !isAnthropicProvider) return cleanSchemaForGemini(s);
  return s;  // All other providers get raw schema — including Ark
}

The schema cleaning is provider-specific (only Google/Gemini), but the problem is universal — any OpenAI-compatible provider that doesn't support full JSON Schema keywords will fail.

Affected providers (known)

  • BytePlus Ark (doubao-seed, doubao-pro, etc.)
  • Google Cloud Code Assist / Antigravity (fixed in #19860)
  • Potentially: any strict OpenAI-compatible provider

Suggested fix

Instead of adding provider checks one by one, make schema cleaning universal or configurable:

Option A (recommended): Apply cleanSchemaForGemini()-style cleaning to all OpenAI-compatible providers by default (Anthropic native API supports full JSON Schema, so it can be excluded).

Option B: Add a compat.cleanSchemaKeywords: true flag in model/provider config so users can enable cleaning per-provider.

Option C (minimal): Add Ark/BytePlus to the existing provider check alongside Gemini.

Environment

  • OpenClaw version: 2026.3.13
  • Provider: BytePlus Ark (openai-completions API)
  • Model: doubao-seed-2-0-pro-260215
  • OS: Linux (Ubuntu)

Related

  • #19860 — Same bug for Google Cloud Code Assist (fixed)
  • #6540 — Prompt cache segmentation (tangentially related schema handling)

extent analysis

Fix Plan

To fix the issue, we will apply the recommended Option A: Apply cleanSchemaForGemini()-style cleaning to all OpenAI-compatible providers by default.

Here are the steps:

  • Modify the applyProviderCleaning function to exclude only Anthropic native API:
function applyProviderCleaning(s) {
  if (options?.modelProvider?.toLowerCase().includes("anthropic")) return s;
  return cleanSchemaForGemini(s);
}
  • Alternatively, you can add a check to ensure that the cleaning function is applied to all providers that are not Anthropic:
const isAnthropicProvider = options?.modelProvider?.toLowerCase().includes("anthropic");

function applyProviderCleaning(s) {
  if (!isAnthropicProvider) return cleanSchemaForGemini(s);
  return s;
}

Verification

To verify that the fix worked, follow these steps:

  • Configure a model provider using BytePlus Ark API (e.g., doubao-seed-2-0-pro-260215).
  • Ensure the agent has exec tool enabled.
  • Send any message that triggers tool use.
  • Check that the API returns a successful response (not HTTP 400).

Extra Tips

  • Make sure to test the fix with different providers to ensure that it works as expected.
  • Consider adding logging or monitoring to detect any potential issues with the cleaning function.
  • If you encounter any problems with the fix, refer to the related issues (#19860 and #6540) for more information on schema handling.

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…

FAQ

Expected behavior

Tool calls are sent to the API and processed normally.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING