Skip to content

Commit 3d8e4ef

Browse files
mjnoviceclaude
andcommitted
debug: improve error extraction for memory recall 400 responses
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent dc3904b commit 3d8e4ef

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

src/uipath_langchain/agent/react/memory_node.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,18 +93,16 @@ async def memory_recall_node(state: Any) -> dict[str, Any]:
9393
memory_config.memory_space_id,
9494
)
9595
except Exception as e:
96-
# Try to extract HTTP response body from the exception
97-
error_detail = str(e)
98-
if hasattr(e, "response"):
99-
try:
100-
error_detail = f"{e} | body={e.response.text}" # type: ignore[union-attr]
101-
except Exception:
102-
pass
103-
elif hasattr(e, "__cause__") and hasattr(e.__cause__, "response"):
104-
try:
105-
error_detail = f"{e} | body={e.__cause__.response.text}" # type: ignore[union-attr]
106-
except Exception:
107-
pass
96+
# Try to extract HTTP response body from the exception chain
97+
error_detail = repr(e)
98+
for exc in [e, getattr(e, "__cause__", None), getattr(e, "__context__", None)]:
99+
if exc and hasattr(exc, "response"):
100+
try:
101+
resp = exc.response # type: ignore[union-attr]
102+
error_detail = f"{exc} | status={resp.status_code} body={resp.text}"
103+
except Exception:
104+
pass
105+
break
108106
logger.warning(
109107
"Memory recall failed for space '%s': %s",
110108
memory_config.memory_space_id,

0 commit comments

Comments
 (0)