anthropics / anthropics/claude-code

2.1.266: Artifact tool schema uses \p{...} Unicode property escapes in pattern — 400 invalid_request on Anthropic-compatible endpoints (z.ai GLM)

Offen
#93,029 0 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
area:providers area:tools bug duplicate platform:macos
Vorherrschende Sprache
Python
Sterne
145k
Forks
23.1k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

## Version
Claude Code 2.1.266

## Bug
Version 2.1.266 introduced the built-in `Artifact` tool. Its `input_schema` includes a `field` property whose JSON Schema `pattern` contains Unicode property escapes:

```
^(?!__.*__$)[^\p{Cc}\p{Cf}\p{Zl}\p{Zp}"\\./\[\]]{1,200}$
```

The z.ai GLM Anthropic-compatible endpoint (`https://api.z.ai/api/anthropic`, used by GLM Coding Plan subscribers) validates `pattern` regexes with an engine that cannot compile `\p{...}` escapes and rejects the entire request with:

```json
{"type":"error","error":{"type":"invalid_request_error","code":"1210","message":"[1210][Invalid API parameter, please check the documentation.]"}}
```

Result: **every request from Claude Code ≥ 2.1.266 fails with API Error 400 on z.ai's Anthropic-compat endpoint**, since the tool list is sent on every call. This broke previously working setups the moment 2.1.266 auto-updated.

## Isolation (bisected by replaying captured requests)
- Full request with the Artifact tool → 400 code 1210
- Identical request with only the `Artifact` tool removed → 200
- Artifact tool with all `pattern` constraints removed → 200
- Simple pattern (`^[0-9a-f]{32}$`) → 200; regex lookahead `(?!...)` → 200
- **Any pattern containing `\p{Cc}`-style escapes → 400**

## Suggested fix
Avoid Unicode property escapes in tool schema patterns (replace `[^\p{Cc}...]` with an explicit character class or drop the constraint). These escapes are valid JSON Schema 2020-12 but are evidently not universally supported by Anthropic-API-compatible providers, so shipping them in a default-enabled built-in tool breaks third-party endpoints.

## Environment
- macOS 15, arm64
- `ANTHROPIC_BASE_URL=https://api.z.ai/api/anthropic`, model glm-5.3
- Local workaround: our proxy (9router) strips `\p{...}`/`\P{...}` from `tools[].input_schema` patterns before forwarding

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Search for the built-in Artifact tool definition and its input_schema field pattern containing \p{Cc}/\p{Cf}/\p{Zl}/\p{Zp}. Reproduce by sending Claude Code 2.1.266 through ANTHROPIC_BASE_URL=https://api.z.ai/api/anthropic or by replaying a captured request. Done means the default tool schema no longer sends Unicode property escapes and the z.ai Anthropic-compatible endpoint accepts the request.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
json
Bereich
api, cli
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Aktiv
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
68/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.