Skip to content

Provider API: tool JSON-Schema pattern with \0 escape kills the whole request — DeepSeek lane 502/overloaded_error (Claude Code Artifact tool affected) #1156

Open

Description

@parapuda

Summary

A single pattern value containing the \0 escape in a tool's JSON Schema makes the DeepSeek provider lane fail the entire request. Claude Code's built-in Artifact tool carries exactly such a pattern (file_paths.items.pattern = "^[^\\0]*$"), so every interactive Claude Code session targeting DeepSeek models through the Command Code provider fails with 502 storms, while headless runs (which carry fewer tools) and other harnesses (pi, etc.) work fine.

Minimal reproduction

Send any request whose tools array contains this one tool (nothing else matters — one message, max_tokens: 16):

{
  "name": "ProbeTool",
  "description": "x",
  "input_schema": {
    "type": "object",
    "properties": {
      "a": { "type": "array", "items": { "type": "string", "pattern": "^[^\\0]*$" } }
    }
  }
}
  • With this tool → request fails: the SSE stream opens and immediately emits event: error with {"type":"overloaded_error","message":"The provider failed to complete the request."}, or the connection dies with zero bytes (attributed as upstream-fault / protocol-prelude by the opencodex proxy, surfaced as HTTP 502 to Claude Code).
  • Without the pattern field (everything else identical) → 200, normal completion.

Bisected all the way down: the pattern string is the sole trigger. Removing any other part of the request (tools, messages, system, context_management, output_config, thinking, effort) does not help; removing only the pattern fixes it.

Observed surfaces

  1. Via opencodex proxy → Command Code → deepseek-v4.1-flash: deterministic failure on every retry of the same body (52 consecutive 502s over ~20 minutes for one conversation), interleaved with 200s from smaller/differently-shaped requests. ocx log entries: failureCause=upstream-fault, failureStage=protocol-prelude, 0 bytes of semantic output.
  2. Via OmniRoute → Command Code → cmd/deepseek/deepseek-v4.1-flash: same body returns HTTP 400 with {"message": "Prefill server error (400 Bad Request): {<path>..."} — which names the failing component: the prefill/schema-compilation layer. (Message is truncated mid-JSON in the relayed error, which is its own small bug.)

Expected

A regex escape that the prefill/grammar compiler cannot digest should produce a clear 4xx error naming the offending tool/field — not a silent provider death that retries amplify into 502 storms.

Impact

Any interactive Claude Code session using DeepSeek models through the Command Code provider carries the Artifact tool and is affected. Worked around locally by stripping \0-containing pattern values from tool schemas before forwarding.

Environment

  • Client: Claude Code 2.1.327 (tools include the harness Artifact schema)
  • Model: command-code/deepseek/deepseek-v4.1-flash
  • Date of measurements: 2026-11-18

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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