alibaba/spring-ai-alibaba · error · BizException

InvalidParameter

InvalidParameter

Error message

Parameters input_params invalid, Get method not support body params.

What it means

Validation thrown by PluginServiceImpl.createTool when the tool's HTTP request method is GET but one of its input parameters has location 'Body'. GET requests cannot carry a request body, so the tool configuration is rejected with code InvalidParameter.

Source

Thrown at spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/base/service/impl/PluginServiceImpl.java:285

	@Override
	public String createTool(Tool tool) {
		try {
			RequestContext context = RequestContextHolder.getRequestContext();
			Plugin plugin = getPlugin(tool.getPluginId());

			// check if tool name exists
			ToolEntity toolEntity = getToolByName(context.getWorkspaceId(), plugin.getPluginId(), tool.getName());
			if (toolEntity != null) {
				throw new BizException(ErrorCode.TOOL_NAME_EXISTS.toError());
			}

			Tool.ToolConfig config = tool.getConfig();
			List<ApiParameter> inputParams = config.getInputParams();
			if (!CollectionUtils.isEmpty(inputParams)) {
				for (ApiParameter apiParameter : inputParams) {
					String location = apiParameter.getLocation();
					if ("Get".equals(config.getRequestMethod()) && location.equals("Body")) {
						throw new BizException(
								ErrorCode.INVALID_PARAMS.toError("input_params", "Get method not support body params"));
					}
				}
			}

			// convert to swagger yaml
			String yaml = OpenApiUtils.buildOpenAPIYaml(plugin, tool);

			if (StringUtils.isBlank(yaml) || !CollectionUtils.isEmpty(OpenApiUtils.parseOpenAPIObject(yaml))) {
				throw new BizException(ErrorCode.BUILD_TOOL_SCHEMA_ERROR.toError());
			}

			String toolId = IdGenerator.idStr();
			ToolEntity entity = BeanCopierUtils.copy(tool, ToolEntity.class);
			entity.setToolId(toolId);
			entity.setPluginId(tool.getPluginId());
			entity.setWorkspaceId(context.getWorkspaceId());
			entity.setConfig(JsonUtils.toJson(tool.getConfig()));

View on GitHub (pinned to f82da0b50f)

Solutions

  1. Change the request method to POST/PUT/PATCH if a body is required
  2. Convert body parameters into query parameters for GET requests
  3. Remove Body-located parameters from GET tool configs before creation

Example fix

// before
tool.getConfig().setRequestMethod("Get");
inputParams.add(param("q", "Body"));
pluginService.createTool(tool); // throws
// after
tool.getConfig().setRequestMethod("Get");
inputParams.add(param("q", "Query")); // move body params to query
pluginService.createTool(tool);
Defensive patterns

Strategy: validation

Validate before calling

Tool.ToolConfig cfg = tool.getConfig();
boolean bad = "Get".equalsIgnoreCase(cfg.getRequestMethod())
    && cfg.getInputParams() != null
    && cfg.getInputParams().stream()
        .anyMatch(p -> "Body".equalsIgnoreCase(p.getLocation()));
if (bad) throw new IllegalArgumentException("GET tools cannot have Body params");

Type guard

boolean isGetWithBody(Tool.ToolConfig cfg) {
    return "Get".equalsIgnoreCase(cfg.getRequestMethod())
        && cfg.getInputParams() != null
        && cfg.getInputParams().stream().anyMatch(p -> "Body".equalsIgnoreCase(p.getLocation()));
}

Try / catch

try {
    pluginService.createTool(tool);
} catch (BizException e) {
    throw new ResponseStatusException(HttpStatus.BAD_REQUEST,
        "GET method does not support body params", e);
}

Prevention

When it happens

Trigger: createTool(tool) where tool.getConfig().getRequestMethod() equals "Get" and any inputParams entry has apiParameter.getLocation() == "Body".

Common situations: Designing a tool from an API spec that uses GET but defines requestBody (OpenAPI quirks); users selecting GET in the UI while leaving body parameters configured; migrated/imported tool definitions.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of alibaba/spring-ai-alibaba@f82da0b50f (2026-09-09). Data as JSON: /api/errors/380ff360936876e5. Report an issue: GitHub.