{"record":{"id":"b44f6ad005e799a6","repo":"iflytek/astron-agent","slug":"param-error-b44f6a","errorCode":"PARAM_ERROR","errorMessage":"PARAM_ERROR","messagePattern":"PARAM_ERROR","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowService.java","lineNumber":5514,"sourceCode":"            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));\n\n            Date now = new Date();\n            for (WorkflowComparisonSaveReq data : workflowComparisonReqList) {\n                WorkflowComparison wc = new WorkflowComparison();\n                wc.setFlowId(data.getFlowId());\n                wc.setType(data.getType());\n                wc.setPromptId(data.getPromptId());\n                wc.setData(JSONObject.toJSONString(data.getData()));","sourceCodeStart":5496,"sourceCodeEnd":5532,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowService.java#L5496-L5532","documentation":"Thrown by saveComparisons when the batch is invalid: the first item is null, its flowId is blank, or any item in the list is null or has a different flowId. All comparison groups in one save must belong to the same workflow flowId.","triggerScenarios":"Submitting a comparison batch where entries carry inconsistent flowIds (e.g. merging rows from two workflows), passing null elements in the JSON array, or omitting flowId on the first item.","commonSituations":"Client-side state mixing rows from a previous edit session; copy-paste of comparison rows between workflows; malformed request payload where flowId is missing on some items.","solutions":["Ensure every WorkflowComparisonSaveReq in the list has the same non-blank flowId as the first element.","Fix the client so a save batch is built from a single workflow's comparison rows only.","Validate/sanitize the payload before sending: drop null items and check flowId equality."],"exampleFix":"// before\nList<WorkflowComparisonSaveReq> mixed = List.of(a, bFromOtherFlow);\nworkflowService.saveComparisons(mixed);\n// after\nString flowId = a.getFlowId();\nList<WorkflowComparisonSaveReq> clean = reqList.stream()\n    .filter(Objects::nonNull)\n    .filter(r -> StringUtils.isNotBlank(r.getFlowId()) && r.getFlowId().equals(flowId))\n    .collect(Collectors.toList());\nworkflowService.saveComparisons(clean);","handlingStrategy":"validation","validationCode":"Set<String> flowIds = reqList.stream()\n    .filter(Objects::nonNull)\n    .map(WorkflowComparisonSaveReq::getFlowId)\n    .filter(StringUtils::isNotBlank)\n    .collect(Collectors.toSet());\nif (flowIds.size() != 1) throw new BusinessException(ResponseEnum.PARAM_ERROR);","typeGuard":"boolean singleFlow = list != null && !list.isEmpty() && list.stream().allMatch(r -> r != null\n    && StringUtils.isNotBlank(r.getFlowId())\n    && r.getFlowId().equals(list.get(0).getFlowId()));","tryCatchPattern":"try {\n    workflowService.saveComparisons(reqList);\n} catch (BusinessException e) {\n    if (\"PARAM_ERROR\".equals(e.getCode())) {\n        // rebuild the batch from a single workflow's rows\n    } else { throw e; }\n}","preventionTips":["Build save batches only from one workflow's comparison editor state.","Drop null elements and rows lacking flowId before sending.","Clear client state when switching workflows during editing."],"tags":["java","validation","workflow","parameters"],"backgroundTag":"invalid-argument-value","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"}