Skip to content

[Bug]: Poolside v1 tool parser raises on numeric arguments like 1e999 and on deeply nested JSON arguments #20991

Open

Description

@LeizhenZhang

System Info

  • TensorRT-LLM main at 687359e (tensorrt_llm/serve/tool_parser/poolside_v1_parser.py), pure Python. A CPU is enough to reproduce.
  • Python 3.12
  • Serving path: trtllm-serve <Laguna model> --tool_parser poolside_v1, chat completions with tools, streaming and non-streaming

Who can help?

@NVIDIA/trt-llm-runtime-devs (CODEOWNERS for tensorrt_llm/serve)

Reproduction

from tensorrt_llm.serve.openai_protocol import ChatCompletionToolsParam
from tensorrt_llm.serve.tool_parser.poolside_v1_parser import PoolsideV1ToolParser

def tools(arg_type):
    return [ChatCompletionToolsParam(function={
        "name": "f", "parameters": {"type": "object", "properties": {"v": {"type": arg_type}}}})]

def call(raw):
    return f"<tool_call>f\n<arg_key>v</arg_key>\n<arg_value>{raw}</arg_value>\n</tool_call>"

PoolsideV1ToolParser().detect_and_parse(call("1e999"), tools("integer"))
# OverflowError: cannot convert float infinity to integer
PoolsideV1ToolParser().detect_and_parse(call("9" * 400), tools("number"))
# OverflowError: int too large to convert to float
PoolsideV1ToolParser().detect_and_parse(call("[" * 100000 + "]" * 100000), tools("array"))
# RecursionError: maximum recursion depth exceeded while decoding a JSON array
PoolsideV1ToolParser().detect_and_parse(call("NaN"), tools("number")).calls[0].parameters
# '{"v": NaN}'

parse_streaming_increment raises the same exceptions when the tool call closes.

Expected behavior

The parser returns the tool call for any model output. A value that has no strict JSON form keeps its raw text, the same way glm4_parser.parse_arguments already handles 1e309 and NaN for the same <arg_key>/<arg_value> format.

actual behavior

value declared type result on main
1e999, Infinity, -Infinity integer OverflowError at poolside_v1_parser.py:76
400 digits number OverflowError at poolside_v1_parser.py:81
100000 nested [ any non-string RecursionError at poolside_v1_parser.py:70
NaN, 1e999, [1e999] number, array returns a call whose arguments string holds NaN or Infinity, which strict JSON parsers reject

The exception leaves the parser. On the non-streaming path openai_chat turns it into an HTTP 400 error that carries the Python message, so the whole generation is lost. On the streaming path chat_stream_generator logs it and re-raises, so the event stream stops without a final chunk or data: [DONE]. /v1/responses calls the same parser without a guard.

additional notes

_parse_argument_value catches (json.JSONDecodeError, ValueError) around json.loads and (TypeError, ValueError) around int(parsed) and float(parsed). json.loads returns float("inf") for 1e999 and Infinity, and int(inf) raises OverflowError. float() of an integer with more than 308 digits raises OverflowError. Deep nesting makes json.loads raise RecursionError. I have a fix with tests ready and will open a PR that references this issue.

Activity

  1. added a commit that references this issue on Oct 27, 2026
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