Repository navigation
Replies: 1 comment
|
Confirmed: the regex fails locally on a 5 MB payload.
The round-trip at Same pattern exists in Yes to the PR: remove the regex test, keep the round-trip, and add a test with a few-MB payload so the regression stays visible. I only ran the regex locally; no MCP server round trip here. You can hand this to an AI assistant to prepare that two-file patch. |
Uh oh!
There was an error while loading. Please reload this page.
Summary
@deepseek-ai/dsh-mcp-clientrejects large image content blocks withRangeError: Maximum call stack size exceeded. The tool result then degrades to atext placeholder and the model never sees the image.
Affects
0.2.1-rc.5and0.2.2-rc.1(verified by unpacking both npm tarballs).Where
packages/mcp-client→lib/index.js(published as@deepseek-ai/dsh-mcp-client):Repro
An MCP server returns an image content block whose
datais a ~5 MB base64 payload(in our case a QQ animated GIF relayed through an MCP tool).
CANONICAL_BASE64.test(data)throwsRangeError: Maximum call stack size exceeded.The error is caught upstream, so instead of failing loudly the tool result becomes:
Static screenshots (100-300 KB) go through fine, so the failure is purely
size-dependent. Any MCP server returning large images is affected; it is not
specific to one plugin or one MIME type. An oversized PNG/JPEG hits it too.
Cause
The nested quantifier
(?:[A-Za-z0-9+/]{4})*plus an optional tail makes the V8regex engine recurse once per repetition. For subject strings in the multi-MB range
that exceeds the call stack.
Suggested fix
Drop the regex check. Line 273 already validates exactly the same property by
round-tripping the decode (
Buffer.from(data, "base64").toString("base64") !== data),which is linear and cannot blow the stack. Removing line 271 keeps the guarantee and
fixes every oversized image regardless of MIME type.
Happy to send a PR if that is wanted.
All reactions