{"record":{"id":"59f6fec7736ee4b6","repo":"alibaba/spring-ai-alibaba","slug":"tool-params-missing","errorCode":"TOOL_PARAMS_MISSING","errorMessage":"TOOL_PARAMS_MISSING: execution_request","messagePattern":"TOOL_PARAMS_MISSING: execution_request","errorType":"error_code","errorClass":"BizException","httpStatus":null,"severity":"error","filePath":"spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/base/service/impl/ToolExecutionServiceImpl.java","lineNumber":74,"sourceCode":"\tprivate final PluginService pluginService;\n\n\t/** Manager for handling HTTP client operations */\n\tprivate final HttpClientManager httpClientManager;\n\n\tpublic ToolExecutionServiceImpl(PluginService pluginService, HttpClientManager httpClientManager) {\n\t\tthis.pluginService = pluginService;\n\t\tthis.httpClientManager = httpClientManager;\n\t}\n\n\t/**\n\t * Executes a tool based on the provided request. Validates the request and retrieves\n\t * necessary tool and plugin information.\n\t * @param request The tool execution request containing arguments and tool information\n\t * @return The result of the tool execution\n\t */\n\tpublic ToolExecutionResult executeTool(ToolExecutionRequest request) {\n\t\tif (request == null) {\n\t\t\tthrow new BizException(ErrorCode.TOOL_PARAMS_MISSING.toError(\"execution_request\"));\n\t\t}\n\n\t\tMap<String, Object> inputParams = request.getArguments();\n\t\tif (inputParams == null) {\n\t\t\tthrow new BizException(ErrorCode.TOOL_PARAMS_MISSING.toError(\"arguments\"));\n\t\t}\n\n\t\tif (request.getTool() == null) {\n\t\t\tif (Objects.isNull(request.getToolId())) {\n\t\t\t\tthrow new BizException(ErrorCode.TOOL_PARAMS_MISSING.toError(\"tool_id\"));\n\t\t\t}\n\n\t\t\tTool tool = pluginService.getTool(request.getToolId());\n\t\t\trequest.setTool(tool);\n\n\t\t\tif (tool.getPlugin() == null) {\n\t\t\t\tif (Objects.isNull(request.getPluginId())) {\n\t\t\t\t\tthrow new BizException(ErrorCode.TOOL_PARAMS_MISSING.toError(\"plugin_id\"));","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/base/service/impl/ToolExecutionServiceImpl.java#L56-L92","documentation":"TOOL_PARAMS_MISSING with parameter 'execution_request' is thrown by ToolExecutionServiceImpl.executeTool when the ToolExecutionRequest argument itself is null. The method cannot proceed without any request object, so it fails fast with this validation error.","triggerScenarios":"Calling executeTool(null), e.g. when an upstream builder returned null on failure, a controller passed an unbound request body, or deserialization of the request payload failed and produced null.","commonSituations":"REST controller receiving an empty body mapped to a null request; a workflow node constructing the request conditionally and skipping creation; unit tests invoking the service with no request.","solutions":["Ensure a non-null ToolExecutionRequest is constructed before calling executeTool.","Check deserialization: send a valid JSON body with required fields so the request binds to an object.","In controllers, use @Valid/@NotNull on the request parameter to reject null bodies earlier.","Null-check or use Optional around the code path that produces the request before invoking executeTool."],"exampleFix":"// before\nToolExecutionResult result = toolExecutionService.executeTool(buildRequest(input));\n// after\nToolExecutionRequest req = buildRequest(input);\nif (req == null) {\n    throw new IllegalArgumentException(\"tool execution request is required\");\n}\nToolExecutionResult result = toolExecutionService.executeTool(req);","handlingStrategy":"type-guard","validationCode":"if (request == null) {\n    throw new IllegalArgumentException(\"execution_request is required\");\n}\ntoolExecutionService.executeTool(request);","typeGuard":"ToolExecutionRequest requireRequest(ToolExecutionRequest r) {\n    return Objects.requireNonNull(r, \"execution_request must not be null\");\n}","tryCatchPattern":"try {\n    toolExecutionService.executeTool(request);\n} catch (BizException e) {\n    if (e.getMessage().contains(\"execution_request\")) {\n        // log and return 400: request body missing\n    }\n    throw e;\n}","preventionTips":["Use @NotNull/@Valid on controller request bodies so nulls are rejected at the boundary.","Never let builders return null — throw or return Optional instead.","Add a fail-fast null check at the caller of executeTool.","Cover the null-request path in unit tests."],"tags":["validation","null-argument","tool-execution"],"backgroundTag":"null-argument","analyzedSha":"f82da0b50f35744c13968191be2b1cd2452ef550","analyzedAt":"2026-09-09T15:32:42.421Z","contentChangedAt":"2026-09-09T15:32:42.421Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}