{"record":{"id":"25dd036505d3ed3f","repo":"conductor-oss/conductor","slug":"failed-to-call-mcp-tool-toolname-on-serverurl","errorCode":null,"errorMessage":"Failed to call MCP tool '{toolName}' on {serverUrl}: {message}","messagePattern":"Failed to call MCP tool '(.+?)' on (.+?): (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"ai/src/main/java/org/conductoross/conductor/ai/mcp/MCPService.java","lineNumber":289,"sourceCode":"\n            // Process the result JSON to parse text content as JSON where applicable\n            processResultJson(resultNode);\n\n            // Return as Map to preserve parsed field\n            Map<String, Object> result = objectMapper.convertValue(resultNode, Map.class);\n            ExternalDataLimits.validateStructure(result);\n\n            log.debug(\n                    \"Successfully called tool '{}' via direct JSON-RPC on {}\", toolName, serverUrl);\n            return result;\n\n        } catch (Exception e) {\n            log.error(\n                    \"Failed to call tool '{}' via direct JSON-RPC on {}: {}\",\n                    toolName,\n                    serverUrl,\n                    e.getMessage());\n            throw new RuntimeException(\n                    \"Failed to call MCP tool '\"\n                            + toolName\n                            + \"' on \"\n                            + serverUrl\n                            + \": \"\n                            + e.getMessage(),\n                    e);\n        }\n    }\n\n    /**\n     * Processes a CallToolResult JSON node to parse JSON strings in text content.\n     *\n     * <p>Modifies the JSON response before deserialization to convert JSON strings to objects.\n     */\n    private void processResultJson(JsonNode resultNode) {\n        if (resultNode == null || !resultNode.has(\"content\")) {\n            return;","sourceCodeStart":271,"sourceCodeEnd":307,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/ai/src/main/java/org/conductoross/conductor/ai/mcp/MCPService.java#L271-L307","documentation":"Catch-all wrapper thrown by callToolDirectHttp's outer catch (Exception). Wraps ANY exception from the tool-call flow (165/166/167, SSE parse 169/170, redirect 171-173, payload limit 175/176, or network IOException) with toolName, serverUrl, original message, and the cause. This is the exception callers of callTool see for almost every failure.","triggerScenarios":"Any uncaught exception inside callToolDirectHttp's try: network timeout, SSL/DNS failure, JSON-RPC protocol error, redirect/credential/payload violation, or one of errors 165-167/169/170.","commonSituations":"Server unreachable; auth expired; tool crashed; arguments invalid. The wrapper hides the root cause behind a generic prefix — operators must read getCause().","solutions":["Inspect e.getCause() for the real failure; the wrapper text alone is insufficient.","Map the cause to its specific error (165-167, 169-170, 171-176) and apply that fix.","For transient network causes, retry with backoff.","Log the unwrapped cause chain so dashboards show root reasons."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    Map<String,Object> r = mcpService.callTool(serverUrl, toolName, arguments, headers);\n} catch (RuntimeException e) {\n    Throwable root = e;\n    while (root.getCause() != null && root.getCause() != root) root = root.getCause();\n    log.error(\"callTool '{}' failed for {}: rootCause={}\", toolName, serverUrl, root.toString());\n    throw e;\n}","preventionTips":["Unwrap the cause to find the real failure class.","Route root-cause info to monitoring, not the wrapper prefix.","Retry only on transient root causes (network/5xx), never on protocol/security causes."],"tags":["mcp","wrapper","network","error-handling","tool-call"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}