{"record":{"id":"fd1ec9bff876d7f9","repo":"iflytek/astron-agent","slug":"prompt-group-prompt-cannot-empty","errorCode":"PROMPT_GROUP_PROMPT_CANNOT_EMPTY","errorMessage":"PROMPT_GROUP_PROMPT_CANNOT_EMPTY","messagePattern":"PROMPT_GROUP_PROMPT_CANNOT_EMPTY","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"warning","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowService.java","lineNumber":5506,"sourceCode":"        }\n        if (domain.contains(\"gemini\")) {\n            return \"google\";\n        }\n        if (domain.contains(\"qwen\")) {\n            return \"qwen\";\n        }\n        if (domain.contains(\"moonshot\") || domain.contains(\"kimi\")) {\n            return \"moonshot\";\n        }\n        if (domain.contains(\"doubao\")) {\n            return \"doubao\";\n        }\n        return StringUtils.isBlank(llmInfoVo.getUrl()) ? \"xinghuo\" : \"openai\";\n    }\n\n    public String saveComparisons(List<WorkflowComparisonSaveReq> workflowComparisonReqList) {\n        if (workflowComparisonReqList == null || workflowComparisonReqList.isEmpty()) {\n            throw new BusinessException(ResponseEnum.PROMPT_GROUP_PROMPT_CANNOT_EMPTY);\n        }\n\n        WorkflowComparisonSaveReq first = workflowComparisonReqList.getFirst();\n        if (first == null || StringUtils.isBlank(first.getFlowId())\n                || workflowComparisonReqList.stream()\n                        .anyMatch(item -> item == null\n                                || !StringUtils.equals(first.getFlowId(), item.getFlowId()))) {\n            throw new BusinessException(ResponseEnum.PARAM_ERROR);\n        }\n\n        final String flowIdForLog = first.getFlowId();\n\n        try {\n            requireOwnedWorkflow(flowIdForLog);\n\n            workflowComparisonMapper.delete(\n                    Wrappers.lambdaQuery(WorkflowComparison.class)\n                            .eq(WorkflowComparison::getFlowId, flowIdForLog));","sourceCodeStart":5488,"sourceCodeEnd":5524,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowService.java#L5488-L5524","documentation":"Thrown by WorkflowService.saveComparisons when the request list of comparison groups is null or empty. There is nothing to save, so the service refuses with PROMPT_GROUP_PROMPT_CANNOT_EMPTY instead of persisting an empty batch.","triggerScenarios":"Calling saveComparisons(null) or saveComparisons with an empty list — typically a frontend submitting a comparison form with zero groups, or a client serializing an empty array after deserialization issues.","commonSituations":"UI allows submitting the comparison dialog with all rows removed; a bulk-update job computed no items and still called the API; a request body failed to deserialize into the list, leaving it empty.","solutions":["Ensure the request contains at least one WorkflowComparisonSaveReq before calling the API.","On the client, disable submit when the comparison list is empty or validate before send.","Return a clearer validation error to the user in the UI instead of hitting the server."],"exampleFix":"// before\nworkflowService.saveComparisons(reqList); // reqList may be empty\n// after\nif (reqList == null || reqList.isEmpty()) {\n    throw new BusinessException(ResponseEnum.PROMPT_GROUP_PROMPT_CANNOT_EMPTY);\n}\nworkflowService.saveComparisons(reqList);","handlingStrategy":"validation","validationCode":"if (reqList == null || reqList.isEmpty()) {\n    throw new IllegalArgumentException(\"comparison list must contain at least one item\");\n}\nworkflowService.saveComparisons(reqList);","typeGuard":"boolean hasItems = list != null && !list.isEmpty();","tryCatchPattern":null,"preventionTips":["Validate payloads before serialization: reject empty arrays at the controller/client.","Disable the save button when the comparison editor has zero rows.","Ensure request deserialization failures do not silently yield an empty list."],"tags":["java","validation","empty-input","workflow"],"backgroundTag":"empty-required-field","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}