From 9993fbfd2ed509e489bf78ca0e7b80f241e3d90a Mon Sep 17 00:00:00 2001 From: zhaopenghao Date: Tue, 23 Jun 2026 06:40:11 +0000 Subject: [PATCH] Enhance sandbox client error handling in _call_json function to include extra_info checks --- lagent/serving/sandbox/client_cli.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lagent/serving/sandbox/client_cli.py b/lagent/serving/sandbox/client_cli.py index 7b05055..47f253e 100644 --- a/lagent/serving/sandbox/client_cli.py +++ b/lagent/serving/sandbox/client_cli.py @@ -32,10 +32,14 @@ def _call_json(sock: str, payload: dict[str, Any]) -> dict[str, Any] | list: obj = json.loads(raw or "{}") except json.JSONDecodeError as exc: raise DaemonCallError(f"invalid daemon response: {exc}: {raw}") from exc - if isinstance(obj, dict) and obj.get("error"): - raise DaemonCallError(str(obj["error"])) if not isinstance(obj, (dict, list)): raise DaemonCallError(f"daemon response must be a JSON object or array, got {type(obj).__name__}") + if isinstance(obj, dict): + if obj.get("error"): + raise DaemonCallError(str(obj["error"])) + extra_info = obj.get("extra_info") + if isinstance(extra_info, dict) and extra_info.get("error"): + raise DaemonCallError(str(extra_info["error"])) return obj