alibaba/spring-ai-alibaba · error · BizException

INVALID_PARAMS

INVALID_PARAMS

Error message

input_params

What it means

ProviderController.addProvider throws this when the request body is null or request.getName() is blank. Unlike validateTool's per-field checks, the whole payload is validated with a single INVALID_PARAMS error keyed 'input_params' (message 'request is valid' — a wording quirk meaning the request is invalid). The provider name is required to register a model provider configuration.

Source

Thrown at spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/builder/controller/ProviderController.java:113

		this.modelManager = modelManager;
		this.redisManager = redisManager;
	}

	/**
	 * Adds a new model provider to the system.
	 *
	 * This endpoint creates a new provider with the following features: - Generates a
	 * unique provider code - Configures provider metadata (name, description, icon) -
	 * Sets up supported model types - Handles credential encryption for sensitive data -
	 * Manages protocol-specific configurations
	 * @param request The provider creation request containing provider details
	 * @return Result indicating success or failure of the operation
	 * @throws BizException if required parameters are missing or invalid
	 */
	@PostMapping
	public Result<Boolean> addProvider(@RequestBody AddProviderRequest request) {
		if (request == null || StringUtils.isBlank(request.getName())) {
			throw new BizException(ErrorCode.INVALID_PARAMS.toError("input_params", "request is valid"));
		}

		// Create provider configuration information
		ProviderConfigInfo providerConfigInfo = new ProviderConfigInfo();
		// Generate an 8-character random code
		String providerCode = IdGenerator.uuid().substring(0, 8);
		providerConfigInfo.setProvider(providerCode);
		providerConfigInfo.setName(request.getName());
		providerConfigInfo.setDescription(request.getDescription());
		providerConfigInfo.setIcon(request.getIcon());
		providerConfigInfo.setSource(DataSourceEnum.custom.name());
		providerConfigInfo.setEnable(true);
		List<String> supportedModelTypes = Lists.newArrayList();
		if (StringUtils.isNotBlank(request.getSupportedModelTypes())) {
			supportedModelTypes
				.addAll(Arrays.stream(request.getSupportedModelTypes().split(",")).collect(Collectors.toList()));
		}
		else {

View on GitHub (pinned to f82da0b50f)

Solutions

  1. Send a JSON body with a non-blank `name` field and Content-Type: application/json
  2. Validate name non-blank client-side before calling addProvider
  3. Fix JSON key naming so Jackson maps the name field
  4. Update clients still using the pre-name-era request shape

Example fix

// before
POST /provider
{}
// after
POST /provider (Content-Type: application/json)
{"name":"dashscope","config":{...}}
Defensive patterns

Strategy: validation

Validate before calling

if (request == null || request.getName() == null || request.getName().isBlank()) { throw new IllegalArgumentException("provider request with non-blank name is required"); }

Type guard

boolean hasName(AddProviderRequest r) { return r != null && r.getName() != null && !r.getName().isBlank(); }

Try / catch

try { providerController.addProvider(request); } catch (BizException e) { if ("input_params".equals(e.getMessage())) { /* resend with a populated name */ } }

Prevention

When it happens

Trigger: POST to the provider endpoint with an empty body, or a body where `name` is missing/empty: {"name":""}.

Common situations: Front-end submitting the provider form before the name field is filled; empty-body POSTs (no Content-Type: application/json causing null deserialization); API clients omitting the name field after a contract change.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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