Bug Description
When using the gstack skill to capture or browse pages, the following error occurs intermittently:
API Error: 400 The request body is not valid JSON: no low surrogate in string: line 1 column 241447 (char 241446)
Root Cause
gstack serializes page content (DOM text, screenshots, etc.) and sends it to the Claude API as JSON. If the page
contains lone Unicode surrogate characters (unpaired \uD800–\uDFFF range), JSON serialization fails and the API rejects
the request with a 400 error.
Steps to Reproduce
- Use the gstack skill to browse or capture a page
- If the page contains special characters or emoji with lone surrogates, the error appears
Expected Behavior
gstack should sanitize or replace lone surrogate characters (e.g., replace with \uFFFD) before serializing to JSON.
Actual Behavior
The entire request fails with a 400 error and gstack cannot proceed.
Notes
- The error position (column ~241447) suggests it occurs deep in a large payload, likely a base64-encoded screenshot or
large DOM text
- The user has no way to prevent or work around this — it requires a fix on the gstack side
Bug Description
When using the gstack skill to capture or browse pages, the following error occurs intermittently:
API Error: 400 The request body is not valid JSON: no low surrogate in string: line 1 column 241447 (char 241446)
Root Cause
gstack serializes page content (DOM text, screenshots, etc.) and sends it to the Claude API as JSON. If the page
contains lone Unicode surrogate characters (unpaired \uD800–\uDFFF range), JSON serialization fails and the API rejects
the request with a 400 error.
Steps to Reproduce
Expected Behavior
gstack should sanitize or replace lone surrogate characters (e.g., replace with \uFFFD) before serializing to JSON.
Actual Behavior
The entire request fails with a 400 error and gstack cannot proceed.
Notes
large DOM text