{"record":{"id":"4b0387ad950a7e15","repo":"alibaba/spring-ai-alibaba","slug":"missing-params-4b0387","errorCode":"MISSING_PARAMS","errorMessage":"request or taskId is null","messagePattern":"request or taskId is null","errorType":"error_code","errorClass":"BizException","httpStatus":null,"severity":"error","filePath":"spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-openapi/src/main/java/com/alibaba/cloud/ai/studio/controller/ChatController.java","lineNumber":329,"sourceCode":"\t@PostMapping(value = { \"/workflow/stop-completions\" })\n\tpublic Result<Boolean> stopCompletion(@RequestBody TaskStopRequest request) {\n\t\tlong start = System.currentTimeMillis();\n\t\tRequestContext requestContext = RequestContextHolder.getRequestContext();\n\t\tif (request == null || StringUtils.isBlank(request.getTaskId())) {\n\t\t\treturn Result.error(requestContext.getRequestId(), ErrorCode.MISSING_PARAMS.toError(\"taskId is null\"));\n\t\t}\n\t\treturn Result.success(workflowService.stop(request));\n\t}\n\n\t@PostMapping(value = { \"/workflow/async-results\" })\n\tpublic Result<AsyncResultResponse> getAsyncResults(@RequestBody AsyncResultRequest request) {\n\t\tlong start = System.currentTimeMillis();\n\t\tRequestContext context = RequestContextHolder.getRequestContext();\n\t\tcontext.setStartTime(System.currentTimeMillis());\n\n\t\ttry {\n\t\t\tif (request == null || request.getTaskId() == null) {\n\t\t\t\tthrow new BizException(ErrorCode.MISSING_PARAMS.toError(\"request or taskId is null\"));\n\t\t\t}\n\n\t\t\t// 从Redis中获取工作流上下文\n\t\t\tString cacheKey = WORKFLOW_TASK_CONTEXT_PREFIX + context.getWorkspaceId() + \"_\" + request.getTaskId();\n\t\t\tWorkflowContext wfContext = redisManager.get(cacheKey);\n\n\t\t\tif (wfContext == null) {\n\t\t\t\tlog.info(\"Async task not found: taskId={}, workspaceId={}, requestId={}\", request.getTaskId(),\n\t\t\t\t\t\tcontext.getWorkspaceId(), context.getRequestId());\n\t\t\t\treturn Result.error(context.getRequestId(),\n\t\t\t\t\t\tErrorCode.WORKFLOW_CONFIG_INVALID.toError(\"taskId not exists\"));\n\t\t\t}\n\n\t\t\t// 构建响应对象\n\t\t\tAsyncResultResponse response = new AsyncResultResponse();\n\t\t\tresponse.setTaskId(request.getTaskId());\n\t\t\tresponse.setRequestId(wfContext.getRequestId());\n\t\t\tresponse.setConversationId(wfContext.getConversationId());","sourceCodeStart":311,"sourceCodeEnd":347,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-openapi/src/main/java/com/alibaba/cloud/ai/studio/controller/ChatController.java#L311-L347","documentation":"BizException thrown by ChatController.getAsyncResults when the request body or its taskId field is null. The endpoint retrieves a workflow context from Redis using workspaceId + taskId, so both must be present before the lookup can proceed. The error carries code MISSING_PARAMS and names the missing piece in its message.","triggerScenarios":"Calling the async-results chat endpoint with an empty/missing JSON body, or with a body whose taskId property is null (e.g. JSON omitted \"taskId\" or sent as null).","commonSituations":"Clients polling for async results with a stale or never-created task id field; deserialization quirks where the JSON property name doesn't match the DTO field so taskId stays null; hand-crafted curl/test calls forgetting the taskId.","solutions":["Include a valid taskId in the request body before calling getAsyncResults.","Verify the JSON property name matches the request DTO field (taskId) exactly, including Jackson naming strategy.","Client-side, check request != null && request.getTaskId() != null before sending the polling call.","Capture the taskId returned when the async task was originally submitted and use that value."],"exampleFix":"// before\nPOST /chat/async/results\n{}\n\n// after\nPOST /chat/async/results\n{\"taskId\": \"b1c2d3e4-...\"}","handlingStrategy":"validation","validationCode":"if (request == null || request.getTaskId() == null || request.getTaskId().isBlank()) {\n  throw new IllegalStateException(\"taskId is required to poll async results\");\n}","typeGuard":"boolean hasTaskId(ChatAsyncRequest r) { return r != null && r.getTaskId() != null && !r.getTaskId().isBlank(); }","tryCatchPattern":"try {\n  results = chatClient.getAsyncResults(req);\n} catch (BizException e) {\n  if (\"MISSING_PARAMS\".equals(e.getCode())) { /* re-submit task or recover taskId */ }\n}","preventionTips":["Always persist the taskId returned at task submission and reuse it for polling.","Validate the request DTO (e.g. @NotBlank taskId) before sending.","Check JSON field names match the DTO exactly to avoid silent null binding."],"tags":["missing-params","http-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"}