From 831107a100078fd1c5e0f6f618f333181a760903 Mon Sep 17 00:00:00 2001 From: Akshay Tripathi <142379735+SHAI-Akshay-Tripathi@users.noreply.github.com> Date: Mon, 25 May 2026 03:45:16 -0700 Subject: [PATCH 1/2] fix(errors): store cli_path as attribute on CLINotFoundError --- src/claude_agent_sdk/_errors.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/claude_agent_sdk/_errors.py b/src/claude_agent_sdk/_errors.py index c86bf235c..e3662dd5b 100644 --- a/src/claude_agent_sdk/_errors.py +++ b/src/claude_agent_sdk/_errors.py @@ -17,6 +17,7 @@ class CLINotFoundError(CLIConnectionError): def __init__( self, message: str = "Claude Code not found", cli_path: str | None = None ): + self.cli_path = cli_path if cli_path: message = f"{message}: {cli_path}" super().__init__(message) From 6fd9fca3e456983837968304d2fd3fa02f283f27 Mon Sep 17 00:00:00 2001 From: Akshay Tripathi <142379735+SHAI-Akshay-Tripathi@users.noreply.github.com> Date: Mon, 25 May 2026 03:47:06 -0700 Subject: [PATCH 2/2] Enhance tests for CLINotFoundError Added tests for CLINotFoundError with and without path. --- tests/test_errors.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/test_errors.py b/tests/test_errors.py index 9490d075b..b8a854dd0 100644 --- a/tests/test_errors.py +++ b/tests/test_errors.py @@ -23,6 +23,14 @@ def test_cli_not_found_error(self): error = CLINotFoundError("Claude Code not found") assert isinstance(error, ClaudeSDKError) assert "Claude Code not found" in str(error) + assert error.cli_path is None + + def test_cli_not_found_error_with_path(self): + """Test CLINotFoundError stores cli_path and includes it in the message.""" + error = CLINotFoundError("Claude Code not found", cli_path="/usr/bin/claude") + assert error.cli_path == "/usr/bin/claude" + assert "Claude Code not found" in str(error) + assert "/usr/bin/claude" in str(error) def test_connection_error(self): """Test CLIConnectionError."""