alibaba/spring-ai-alibaba · error · BizException

MISSING_PARAMS

MISSING_PARAMS

Error message

account

What it means

AccountController.createAccount throws BizException(MISSING_PARAMS, "account") when the @RequestBody Account is null. With Spring's @RequestBody a missing body normally yields 400 before the handler, so this guard mainly catches programmatic/internal calls or proxies that invoke the method with a null account. It names the missing parameter in the error.

Source

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

public class AccountController {

	/** Service for handling account-related business logic */
	private final AccountService accountService;

	public AccountController(AccountService accountService) {
		this.accountService = accountService;
	}

	/**
	 * Creates a new user account
	 * @param account Account information including username and password
	 * @return Account ID of the created account
	 */
	@PostMapping()
	public Result<String> createAccount(@RequestBody Account account) {
		RequestContext context = RequestContextHolder.getRequestContext();
		if (Objects.isNull(account)) {
			throw new BizException(ErrorCode.MISSING_PARAMS.toError("account"));
		}

		if (StringUtils.isBlank(account.getUsername())) {
			throw new BizException(ErrorCode.MISSING_PARAMS.toError("username"));
		}

		if (StringUtils.isBlank(account.getPassword())) {
			throw new BizException(ErrorCode.MISSING_PARAMS.toError("password"));
		}

		String accountId = accountService.createAccount(account);
		return Result.success(context.getRequestId(), accountId);
	}

	/**
	 * Updates an existing account's information
	 * @param accountId ID of the account to update
	 * @param account Updated account information

View on GitHub (pinned to f82da0b50f)

Solutions

  1. Send a JSON Account object as the request body with Content-Type: application/json.
  2. Verify the HTTP method is POST on the collection route and the body is not empty.
  3. Client-side, construct a non-null Account with at least username and password before calling.
  4. In tests, pass a populated Account instance rather than null.

Example fix

// before
null  // empty request body
// after
{"username": "alice", "password": "s3cret"}
Defensive patterns

Strategy: validation

Validate before calling

if (account == null) throw new IllegalArgumentException("account body is required");

Type guard

boolean hasAccount(Account a) { return a != null; }

Try / catch

try {
  id = accountApi.createAccount(account);
} catch (BizException e) {
  if ("MISSING_PARAMS".equals(e.getCode()) && "account".equals(e.getMessage())) {
    // send a populated Account body and retry once
  }
}

Prevention

When it happens

Trigger: Invoking createAccount with a null Account object (internal call, test, or a deserialization path that produced null).

Common situations: Tests calling the controller method directly with null; gateway/proxy stripping the request body; content-type mismatches causing the body not to bind.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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