From 14a11d24b4b5b397ba30369e260976aba6aeb736 Mon Sep 17 00:00:00 2001 From: 0xbyt4 <35742124+0xbyt4@users.noreply.github.com> Date: Thu, 5 Mar 2026 23:09:11 +0300 Subject: [PATCH] fix: handle None args in build_tool_preview When an LLM returns null/empty tool call arguments, json.loads() produces None. build_tool_preview then crashes with "argument of type 'NoneType' is not iterable" on the `in` check. Return None early when args is falsy. --- agent/display.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/agent/display.py b/agent/display.py index 17595ce27..fbd40f8f2 100644 --- a/agent/display.py +++ b/agent/display.py @@ -22,6 +22,8 @@ _RESET = "\033[0m" def build_tool_preview(tool_name: str, args: dict, max_len: int = 40) -> str: """Build a short preview of a tool call's primary argument for display.""" + if not args: + return None primary_args = { "terminal": "command", "web_search": "query", "web_extract": "urls", "read_file": "path", "write_file": "path", "patch": "path",