{"record":{"id":"262df0697c06d7e2","repo":"alibaba/spring-ai-alibaba","slug":"missing-params-262df0","errorCode":"MISSING_PARAMS","errorMessage":"account","messagePattern":"account","errorType":"error_code","errorClass":"BizException","httpStatus":null,"severity":"error","filePath":"spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/builder/controller/AccountController.java","lineNumber":70,"sourceCode":"public class AccountController {\n\n\t/** Service for handling account-related business logic */\n\tprivate final AccountService accountService;\n\n\tpublic AccountController(AccountService accountService) {\n\t\tthis.accountService = accountService;\n\t}\n\n\t/**\n\t * Creates a new user account\n\t * @param account Account information including username and password\n\t * @return Account ID of the created account\n\t */\n\t@PostMapping()\n\tpublic Result<String> createAccount(@RequestBody Account account) {\n\t\tRequestContext context = RequestContextHolder.getRequestContext();\n\t\tif (Objects.isNull(account)) {\n\t\t\tthrow new BizException(ErrorCode.MISSING_PARAMS.toError(\"account\"));\n\t\t}\n\n\t\tif (StringUtils.isBlank(account.getUsername())) {\n\t\t\tthrow new BizException(ErrorCode.MISSING_PARAMS.toError(\"username\"));\n\t\t}\n\n\t\tif (StringUtils.isBlank(account.getPassword())) {\n\t\t\tthrow new BizException(ErrorCode.MISSING_PARAMS.toError(\"password\"));\n\t\t}\n\n\t\tString accountId = accountService.createAccount(account);\n\t\treturn Result.success(context.getRequestId(), accountId);\n\t}\n\n\t/**\n\t * Updates an existing account's information\n\t * @param accountId ID of the account to update\n\t * @param account Updated account information","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/builder/controller/AccountController.java#L52-L88","documentation":"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.","triggerScenarios":"Invoking createAccount with a null Account object (internal call, test, or a deserialization path that produced null).","commonSituations":"Tests calling the controller method directly with null; gateway/proxy stripping the request body; content-type mismatches causing the body not to bind.","solutions":["Send a JSON Account object as the request body with Content-Type: application/json.","Verify the HTTP method is POST on the collection route and the body is not empty.","Client-side, construct a non-null Account with at least username and password before calling.","In tests, pass a populated Account instance rather than null."],"exampleFix":"// before\nnull  // empty request body\n// after\n{\"username\": \"alice\", \"password\": \"s3cret\"}","handlingStrategy":"validation","validationCode":"if (account == null) throw new IllegalArgumentException(\"account body is required\");","typeGuard":"boolean hasAccount(Account a) { return a != null; }","tryCatchPattern":"try {\n  id = accountApi.createAccount(account);\n} catch (BizException e) {\n  if (\"MISSING_PARAMS\".equals(e.getCode()) && \"account\".equals(e.getMessage())) {\n    // send a populated Account body and retry once\n  }\n}","preventionTips":["Always send a JSON body with Content-Type: application/json on POST /accounts.","Build the Account object client-side and assert non-null before the call.","Check proxies/gateways aren't dropping empty request bodies."],"tags":["missing-params","rest-api","validation"],"backgroundTag":"missing-required-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"}