alibaba/spring-ai-alibaba · error · BizException
MISSING_PARAMS
MISSING_PARAMS
Error message
knowledge_base
What it means
POSTing to the knowledge base collection requires a KnowledgeBase JSON body; when the body deserializes to null the controller throws BizException with ErrorCode.MISSING_PARAMS for "knowledge_base" before any service call is made.
Source
Thrown at spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/builder/controller/KnowledgeBaseController.java:76
private final DocumentRetrieverManager documentRetrieverManager;
public KnowledgeBaseController(KnowledgeBaseService knowledgeBaseService,
DocumentRetrieverManager documentRetrieverManager) {
this.knowledgeBaseService = knowledgeBaseService;
this.documentRetrieverManager = documentRetrieverManager;
}
/**
* Creates a new knowledge base
* @param kb Knowledge base configuration
* @return Result containing the created knowledge base ID
*/
@PostMapping()
public Result<String> createKnowledgeBase(@RequestBody KnowledgeBase kb) {
RequestContext context = RequestContextHolder.getRequestContext();
if (Objects.isNull(kb)) {
throw new BizException(ErrorCode.MISSING_PARAMS.toError("knowledge_base"));
}
if (StringUtils.isBlank(kb.getName())) {
throw new BizException(ErrorCode.MISSING_PARAMS.toError("name"));
}
if (kb.getProcessConfig() == null) {
throw new BizException(ErrorCode.MISSING_PARAMS.toError("process_config"));
}
if (kb.getIndexConfig() == null) {
throw new BizException(ErrorCode.MISSING_PARAMS.toError("index_config"));
}
IndexConfig indexConfig = kb.getIndexConfig();
if (StringUtils.isBlank(indexConfig.getEmbeddingProvider())) {
throw new BizException(ErrorCode.MISSING_PARAMS.toError("embedding_provider"));
}View on GitHub (pinned to f82da0b50f)
Solutions
- Send a JSON body representing a KnowledgeBase object with Content-Type: application/json
- Include at least name, processConfig, indexConfig in the payload (they are validated next)
- Confirm the endpoint path is the collection root (POST without /{kbId})
Example fix
// before
curl -X POST http://host/knowledge-base
// (no body -> kb == null)
// after
curl -X POST http://host/knowledge-base \
-H 'Content-Type: application/json' \
-d '{"name":"my-kb","processConfig":{...},"indexConfig":{...}}' Defensive patterns
Strategy: validation
Validate before calling
if (kb == null) throw new IllegalArgumentException("knowledge base request body is required"); Try / catch
try {
String kbId = kbApi.createKnowledgeBase(kb);
} catch (BizException e) {
if (e.getCode().equals("MISSING_PARAMS")) {
// log payload and correct request body
} else { throw e; }
} Prevention
- Always send Content-Type: application/json with a JSON body
- Never POST the knowledge base collection endpoint with an empty body
- Build requests via a typed client model, not hand-written JSON
When it happens
Trigger: POST /knowledge-base (root path) with an empty body, or a body Spring cannot map to KnowledgeBase resulting in a null @RequestBody argument.
Common situations: Client sends no Content-Type: application/json header so the body is not read; empty POST from a script; sending form data instead of JSON.
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/2ee426708536038a.
Report an issue: GitHub.