{"record":{"id":"711df9fff87956bb","repo":"theonedev/onedev","slug":"error-calling-tool-check-server-log-for-detail","errorCode":null,"errorMessage":"Error calling tool '', check server log for details","messagePattern":"Error calling tool '', check server log for details","errorType":"exception","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/ai/ToolUtils.java","lineNumber":103,"sourceCode":"\t\tvar objectMapper = getObjectMapper();\n\t\tif (toolExecutionRequest.arguments() == null)\n\t\t\treturn objectMapper.createObjectNode();\n\n\t\ttry {\n\t\t\treturn objectMapper.readTree(toolExecutionRequest.arguments());\n\t\t} catch (JsonProcessingException e) {\n\t\t\tthrow new RuntimeException(e);\n\t\t}\n\t}\n\n\tpublic static void handleCallException(String toolName, Throwable exception) {\n\t\tif (ExceptionUtils.find(exception, UnauthorizedException.class) != null) \n\t\t\tthrow new ExplicitException(\"Permission denied calling tool: \" + toolName);\n\t\tvar explicitException = ExceptionUtils.find(exception, ExplicitException.class);\n\t\tif (explicitException != null) \n\t\t\tthrow explicitException;\n\t\tlogger.error(\"Error calling tool: \" + toolName, exception);\n\t\tthrow new ExplicitException(\"Error calling tool '\" + toolName + \"', check server log for details\");\n\t}\n\n\tpublic static ChatTool wrapForChat(TaskTool taskTool) {\n\t\treturn new ChatTool() {\n\n\t\t\t@Override\n\t\t\tpublic ToolSpecification getSpecification() {\n\t\t\t\treturn taskTool.getSpecification();\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic CompletableFuture<ToolExecutionResult> execute(@Nullable IPartialPageRequestHandler handler, Subject subject, JsonNode arguments) {\n\t\t\t\treturn CompletableFuture.completedFuture(taskTool.execute(subject, arguments));\n\t\t\t}\n\t\t};\n\t}\n\n\tpublic static List<ChatTool> wrapForChat(List<TaskTool> taskTools) {","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/ai/ToolUtils.java#L85-L121","documentation":"ToolUtils.handleCallException's fallback: if a tool call fails with an exception that is neither an UnauthorizedException nor an ExplicitException, it logs 'Error calling tool: <name>' and throws ExplicitException telling the user to check the server log. The empty tool name in the shown message just means toolName was an empty string at the call site.","triggerScenarios":"Any unexpected runtime exception inside a wrapped AI tool (NPEs, IO errors, service failures) — anything not explicitly categorized — reaching handleCallException.","commonSituations":"Underlying OneDev services throwing unexpected errors (storage issues, git failures); bugs in tool implementations; server-side misconfiguration surfaced through tools.","solutions":["Inspect the server log for 'Error calling tool: <name>' to find the root-cause stack trace.","Fix the underlying cause (project state, storage, configuration) indicated by the stack trace.","Ensure the tool name is passed correctly at call sites (empty name hampers diagnosis).","Retry the tool call after addressing the root cause."],"exampleFix":"// before\nToolUtils.handleCallException(\"\", e); // empty toolName obscures the error\n// after\nToolUtils.handleCallException(\"submitJob\", e);","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { return callTool(name, args); } catch (e) { if (/Error calling tool '.*', check server log/.test(e.message)) { logger.warn(\"Tool \" + name + \" failed; inspect server log\", e); return fallbackResult; } throw e; }","preventionTips":["Always pass the real tool name to handleCallException","Monitor server logs for 'Error calling tool' entries","Wrap tool implementations to convert known failures into ExplicitException with actionable messages"],"tags":["ai-tools","server-error","logging"],"backgroundTag":"upstream-api-error","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}