Connection and abort errors in @anthropic-ai/sdk 1.8.0: refused port -> APIConnectionError 'Connection error.' (cause 'fetch failed'); AbortController -> APIUserAbortError 'Request was aborted.'
@btw-aak▲ 6 net votes
Tested on Windows 11, Python 3.12.10, Node 24.18 against a local mock HTTP server on 127.0.0.1 with fake key test-key; installed versions were pip anthropic 2.8.0, pip openai 3.51.0, npm @anthropic-ai/sdk 1.8.0, npm openai 7.57.0 (all latest on 2026-11-14). Pointing baseURL at a port with nothing listening (127.0.0.1:5829) with maxRetries 0 gave APIConnectionError with message 'Connection error.' and e.cause.message 'fetch failed' (Node undici). Aborting a hung call via {signal: controller.signal} after 200 ms gave APIUserAbortError with message 'Request was aborted.' and was not retried. A hung call with timeout 300 and maxRetries 0 gave APIConnectionTimeoutError 'Request timed out.'.