theonedev/onedev · warning · ExplicitException

Timed out calling tool: ${toolName}

Error message

Timed out calling tool: ${toolName}

What it means

While waiting for the browser/client to execute a requested tool and return its result, the future can be cancelled (e.g. by DefaultManagedFutureService when the enclosing task is cancelled). The service converts this CancellationException into an ExplicitException reporting the tool call as timed out.

Source

Thrown at server-core/src/main/java/io/onedev/server/ai/DefaultChatService.java:338

											return;
										String toolName = toolRequest.name();
										try {
											var toolExecution = new AiToolExecution(toolName, ToolUtils.getToolArguments(toolRequest));
											connection.sendMessage(toolExecution);
											var toolExecutionFuture = toolExecution.getFuture();
											if (toolExecutionFuture == null)
												throw new ExplicitException("Tool not found: " + toolName);
											while (true) {
												try {
													var toolExecutionResult = toolExecutionFuture.get(1, TimeUnit.SECONDS);
													toolExecutionResult.addToMessages(langchain4jMessages, toolRequest);
													break;
												} catch (TimeoutException e) {
													if (responseFuture.isDone())
														return;
												} catch (CancellationException e) {
													// may get cancelled in DefaultManagedFutureService
													throw new ExplicitException("Timed out calling tool: " + toolName);
												}
											}
										} catch (Throwable t) {
											ToolUtils.handleCallException(toolName, t);
										}
									}
									
									if (responseFuture.isDone())
										return;
									
									var handler = newResponseHandler(SecurityUtils.getSubject());
									var langchain4jChatRequest = ChatRequest.builder()
											.messages(new ArrayList<>(langchain4jMessages))
											.toolSpecifications(toolSpecifications)
											.build();							
									streamingChatModel.chat(langchain4jChatRequest, handler);
								} else {
									// No tool calls. If the assistant produced text, use it

View on GitHub (pinned to d44925c47c)

Solutions

  1. Avoid cancelling the conversation while a tool call is in progress, or expect this error as the outcome of cancellation
  2. Check DefaultManagedFutureService timeout settings if tool executions legitimately take longer than the managed limit
  3. Retry the conversation; the tool execution state is discarded on cancel
  4. Ensure the client executes and returns tool results promptly

Example fix

// before: user cancels mid-tool-call -> 'Timed out calling tool: x'
// after: disable the cancel button while a tool call is pending
chatUi.setCancelEnabled(!chatState.isAwaitingToolResult());
Defensive patterns

Strategy: try-catch

Try / catch

try {
    chatService.chat(chatId, prompt);
} catch (ExplicitException e) {
    if (e.getMessage().startsWith("Timed out calling tool: ")) {
        // treat as cancellation: clean up UI state and allow retry
    }
}

Prevention

When it happens

Trigger: During the toolExecutionFuture.get(1, SECONDS) retry loop, a CancellationException is thrown because the overall chat future was cancelled while awaiting the client tool result.

Common situations: User cancels the AI conversation while a tool call is pending; server-managed future cancelled due to task timeout or node shutdown; client takes too long executing the tool so the manager cancels the request.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


AI-assisted analysis of theonedev/onedev@d44925c47c (2026-09-06). Data as JSON: /api/errors/80a7841939977180. Report an issue: GitHub.