{"record":{"id":"34560eb64c5a1fc4","repo":"alibaba/spring-ai-alibaba","slug":"failed-to-parse-advanced-settings-groups-json","errorCode":null,"errorMessage":"Failed to parse 'advanced_settings.groups' JSON","messagePattern":"Failed to parse 'advanced_settings\\.groups' JSON","errorType":"exception","errorClass":"java.lang.RuntimeException","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/generator/service/dsl/converter/VariableAggregatorNodeDataConverter.java","lineNumber":82,"sourceCode":"\t\t\t@Override\n\t\t\tpublic VariableAggregatorNodeData parse(Map<String, Object> data) {\n\t\t\t\tVariableAggregatorNodeData.AdvancedSettings adv;\n\t\t\t\tObject advRaw = data.get(\"advanced_settings\");\n\t\t\t\tif (advRaw instanceof Map<?, ?>) {\n\t\t\t\t\tMap<String, Object> map = (Map<String, Object>) advRaw;\n\t\t\t\t\tadv = new VariableAggregatorNodeData.AdvancedSettings();\n\t\t\t\t\tadv.setGroupEnabled(Boolean.TRUE.equals(map.get(\"group_enabled\")));\n\t\t\t\t\tObject groupsRaw = map.get(\"groups\");\n\t\t\t\t\tif (groupsRaw instanceof List<?>) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tObjectMapper om = new ObjectMapper();\n\t\t\t\t\t\t\tString json = om.writeValueAsString(groupsRaw);\n\t\t\t\t\t\t\tvar list = om.readValue(json, new TypeReference<List<VariableAggregatorNodeData.Groups>>() {\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\tadv.setGroups(list);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcatch (JsonProcessingException e) {\n\t\t\t\t\t\t\tthrow new RuntimeException(\"Failed to parse 'advanced_settings.groups' JSON\", e);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tadv.setGroups(Collections.emptyList());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tadv = new VariableAggregatorNodeData.AdvancedSettings().setGroupEnabled(false)\n\t\t\t\t\t\t.setGroups(Collections.emptyList());\n\t\t\t\t}\n\n\t\t\t\tList<List<String>> vars = Collections.emptyList();\n\t\t\t\tObject varRaw = data.get(\"variables\");\n\t\t\t\tif (varRaw instanceof List<?>) {\n\t\t\t\t\tvars = (List<List<String>>) varRaw;\n\t\t\t\t}\n\n\t\t\t\tString outputTypeStr = (String) data.get(\"output_type\");","sourceCodeStart":64,"sourceCodeEnd":100,"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/generator/service/dsl/converter/VariableAggregatorNodeDataConverter.java#L64-L100","documentation":"Thrown by VariableAggregatorNodeDataConverter.parse when serializing the raw advanced_settings.groups value to JSON and deserializing it into List<VariableAggregatorNodeData.Groups> fails with a JsonProcessingException. This round-trip trick is used to coerce an arbitrary raw structure into the typed Groups list; it fails when the raw shape does not map onto the Groups schema (wrong field names/types, non-list structure).","triggerScenarios":"A Dify/Studio DSL variable-aggregator node whose advanced_settings.groups entries contain fields incompatible with VariableAggregatorNodeData.Groups; groups present as a single object instead of a list; groups entries with renamed fields; nested structures Jackson cannot map.","commonSituations":"Dify DSL version changes renaming group fields; hand-edited advanced_settings blocks; copy-pasted config from another node type; groups defined with extra/missing properties that fail strict mapping.","solutions":["Inspect the cause (JsonProcessingException) to find which group field fails mapping and fix its name/type to match VariableAggregatorNodeData.Groups","Ensure advanced_settings.groups is a JSON array of objects with the fields Groups expects","Remove the advanced_settings.groups block entirely so the converter falls back to an empty list","Align the DSL with a known-good variable-aggregator node export"],"exampleFix":"// before\n\"advanced_settings\": {\"groups\": {\"groupId\": \"g1\"}}\n\n// after\n\"advanced_settings\": {\"groups\": [{\"groupId\": \"g1\", \"variables\": []}]}","handlingStrategy":"validation","validationCode":"Object groups = ((Map<String,Object>) ((Map<String,Object>) nodeData.get(\"advanced_settings\"))).get(\"groups\");\nif (groups != null && !(groups instanceof List<?> list)) throw new IllegalArgumentException(\"advanced_settings.groups must be a list\");\n// optionally round-trip through Jackson to verify Group mapping before import","typeGuard":"boolean hasValidGroupsShape(Map<String,Object> advancedSettings) { Object g = advancedSettings == null ? null : advancedSettings.get(\"groups\"); return g == null || g instanceof List; }","tryCatchPattern":"try { converter.parse(nodeData); } catch (RuntimeException e) { if (e.getMessage().contains(\"advanced_settings.groups\")) { log.error(\"groups JSON does not match Groups schema\", e.getCause()); } throw e; }","preventionTips":["Ensure groups is an array of objects with fields matching VariableAggregatorNodeData.Groups","Delete the advanced_settings.groups block if not needed (converter falls back to empty list)","Check Dify DSL version for renamed group fields","Round-trip groups through Jackson in tests before deploying imports"],"tags":["dsl","json","converter"],"backgroundTag":"json-unmarshal-failed","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"}