From 1c64cb274b4ae556d6fe0201fbd85dc8a921b2ac Mon Sep 17 00:00:00 2001 From: KernelDeimos <7225168+KernelDeimos@users.noreply.github.com> Date: Mon, 29 Sep 2025 15:08:23 -0400 Subject: [PATCH] fix(ai): try overriding timeout to disable error The Anthropic SDK preemptively throws an error if it thinks a response is going to take longer than 10 minutes: https://github.com/anthropics/anthropic-sdk-typescript#long-requests According to this documentation, overriding the `timeout` option disables this error. In this commit the option is changed to the default value of 10 minutes plus an additional 1 second; it is assumed based on the documentation's phrasing that it is not necessary to make the timeout higher but simply to specify a value. --- src/backend/src/modules/puterai/ClaudeService.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/backend/src/modules/puterai/ClaudeService.js b/src/backend/src/modules/puterai/ClaudeService.js index 7dcb41ab7..f6978541d 100644 --- a/src/backend/src/modules/puterai/ClaudeService.js +++ b/src/backend/src/modules/puterai/ClaudeService.js @@ -55,7 +55,12 @@ class ClaudeService extends BaseService { */ async _init () { this.anthropic = new Anthropic({ - apiKey: this.config.apiKey + apiKey: this.config.apiKey, + // 10 minutes is the default; we need to override the timeout to + // disable an "aggressive" preemptive error that's thrown + // erroneously by the SDK. + // (https://github.com/anthropics/anthropic-sdk-typescript/issues/822) + timeout: 10 * 60 * 1001, }); const svc_aiChat = this.services.get('ai-chat');