anomalyco / anomalyco/opencode

[Bug] OpenCode Go upstream 400 [1210] parameter error triggered by Unicode multiplication sign (U+00D7) and trailing quotes in GLM-5.3-Flash

Open
#46,378 0 comments 0 reactions 1 assignee View on GitHub

@fwang is already working on this.

Since Aug 31, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

When sending chat completion requests to glm-5.3-flash via the OpenCode Go gateway (opencode.ai/zen/go/v1), the API deterministically fails with an HTTP 400 error ([1210] API parameter invalid) whenever the request messages contain specific standard Unicode characters—most notably the multiplication sign × (U+00D7) and certain trailing quotation mark sequences like (U+201D).

This is not a rate-limit, context length, or token limit issue. It can be reproduced consistently with a single, minimal 1-turn text prompt.


Environment & Context
  • Model: glm-5.3-flash (via OpenCode Go / Console Go)
  • Endpoint: /zen/go/v1/chat/completions
  • Error Response:
    {
      "error": {
        "type": "server_error",
        "message": "Error from provider (Console Go): Upstream request failed: [1210] API parameter invalid, please check documentation."
      }
    }
    

Minimal Reproducible Example (MRE)
1. Failing Request (U+00D7 Multiplication Sign)
curl -X POST https://opencode.ai/zen/go/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <OPENCODE_GO_API_KEY>" \
  -d '{
    "model": "glm-5.3-flash",
    "messages": [
      {"role": "user", "content": "Test: A \u00D7 B"}
    ]
  }'

Result: HTTP 400 / [1210] API parameter invalid

2. Working Baseline (ASCII x or Alternative Unicode )
curl -X POST https://opencode.ai/zen/go/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <OPENCODE_GO_API_KEY>" \
  -d '{
    "model": "glm-5.3-flash",
    "messages": [
      {"role": "user", "content": "Test: A x B"}
    ]
  }'

Result: HTTP 200 OK


Comparative Test Matrix

Across alternating test rounds executed within the same timeframe, the outcome is 100% deterministic:

Payload Content Unicode Details Upstream Status Result
"Test: A \u00D7 B" Multiplication sign (U+00D7) HTTP 400 [1210] ❌ Deterministic Failure
"Test: A x B" Standard ASCII x (U+0078) HTTP 200 OK ✅ Success
"Test: A \u2715 B" Multiplication X (U+2715) HTTP 200 OK ✅ Success
"Calculate: 3 \u00D7 4 = 12" Multiplication sign (U+00D7) HTTP 400 [1210] ❌ Deterministic Failure
"...memory" + \u201D Right double quotation mark (U+201D) HTTP 400 [1210] ❌ Deterministic Failure
"...memory" + \u201D + " system" Chinese text ending with U+201D HTTP 400 [1210] ❌ Deterministic Failure
"...memory" + \u201D + " of system" Token boundary shifted HTTP 200 OK ✅ Success

Real-World Impact on Multi-Turn Agents

In automated multi-turn AI coding agents or chat systems:

  • If any historical turn (system prompt, tool output, resolution logs like 1920×1080, or arithmetic expressions like 7×24) contains the character \u00D7, the agent re-submits the entire conversation history on subsequent turns.
  • This causes the entire conversation session to permanently fail with [1210], rendering the session unusable unless context compression or manual history sanitization is applied.

Suggested Remediation
  1. Gateway Pre-processing / Normalization:
    • Sanitize or normalize incoming messages text on the OpenCode Go API gateway layer before forwarding to the tokenizer (e.g., auto-substitute \u00D7 with standard ASCII x).
  2. Upstream Tokenizer Fix:
    • Inspect the GLM-5.3-Flash vocabulary and BPE tokenizer boundaries for U+00D7 and edge-case multi-byte quotation combinations (U+201D) to resolve the parser exception.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.