alibaba/spring-ai-alibaba · error · RuntimeException

NotSupportOperation Only Support post/get

Error message

NotSupportOperation Only Support post/get

What it means

parseSchemaToForm() only imports operations defined as post or get; any other OpenAPI operation type (put, delete, patch, head, options) throws RuntimeException("NotSupportOperation Only Support post/get") because the generated tool config models only GET/POST request methods.

Source

Thrown at spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-core/src/main/java/com/alibaba/cloud/ai/studio/core/utils/api/OpenApiUtils.java:280

									}
								}
								else {
									yamlParamInfo.setType(firstLetterToUpperCase(nameSchemaType));
								}
								inputYamlParamList.add(yamlParamInfo);
							});
						});
					}
				}
				else if (pathItem.getGet() != null) {
					operation = pathItem.getGet();
					toolConfig.setRequestMethod("Get");
					if (operation.getParameters() != null) {
						paramToYamlParam(operation.getParameters(), inputYamlParamList);
					}
				}
				else {
					throw new RuntimeException("NotSupportOperation Only Support post/get");
				}

				toolConfig.setInputParams(inputYamlParamList);

				// 添加输出
				ApiResponses apiResponses = operation.getResponses();
				ApiResponse apiResponse = apiResponses.get("200");
				if (apiResponse != null && apiResponse.getContent() != null) {
					MediaType mediaType = apiResponse.getContent()
						.get(org.springframework.http.MediaType.APPLICATION_JSON_VALUE);
					if (mediaType == null) {
						mediaType = apiResponse.getContent()
							.get(org.springframework.http.MediaType.APPLICATION_FORM_URLENCODED_VALUE);
					}

					if (mediaType == null) {
						mediaType = apiResponse.getContent().get("*/*");
					}

View on GitHub (pinned to f82da0b50f)

Solutions

  1. Remove or exclude put/delete/patch operations from the spec before import
  2. Refactor the endpoint to use POST (with an action field) or GET where semantically acceptable
  3. Extend OpenApiUtils to map additional verbs if your use case requires them

Example fix

// before
paths:
  /items/{id}:
    delete: {...}
// after
paths:
  /items/delete:
    post:
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties: {id: {type: string}}
Defensive patterns

Strategy: validation

Validate before calling

boolean supported = paths.values().stream()
    .flatMap(p -> p.readOperations().stream())
    .allMatch(op -> op.getOperationId() == null);
// simpler: check path item keys before import
Set<String> verbs = pathItem.readOperationsMap().keySet().stream()
    .map(Enum::name).map(String::toLowerCase)
    .collect(Collectors.toSet());
if (!verbs.stream().allMatch(v -> v.equals("get") || v.equals("post"))) {
    throw new IllegalArgumentException("Only get/post operations are importable");
}

Try / catch

try {
    OpenApiUtils.parseSchemaToForm(spec);
} catch (RuntimeException e) {
    if (e.getMessage().contains("NotSupportOperation")) {
        // strip or rewrite put/delete/patch operations, then retry
    }
}

Prevention

When it happens

Trigger: Importing an OpenAPI path containing a put/delete/patch operation — e.g. RESTful CRUD specs with DELETE /items/{id} or PATCH endpoints.

Common situations: Importing full CRUD REST specs; APIs using PATCH for partial updates; auto-generated specs from Spring/other frameworks exposing all verbs.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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