alibaba/spring-ai-alibaba · error · java.lang.RuntimeException

Failed to parse 'advanced_settings.groups' JSON

Error message

Failed to parse 'advanced_settings.groups' JSON

What it means

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).

Source

Thrown at 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:82

			@Override
			public VariableAggregatorNodeData parse(Map<String, Object> data) {
				VariableAggregatorNodeData.AdvancedSettings adv;
				Object advRaw = data.get("advanced_settings");
				if (advRaw instanceof Map<?, ?>) {
					Map<String, Object> map = (Map<String, Object>) advRaw;
					adv = new VariableAggregatorNodeData.AdvancedSettings();
					adv.setGroupEnabled(Boolean.TRUE.equals(map.get("group_enabled")));
					Object groupsRaw = map.get("groups");
					if (groupsRaw instanceof List<?>) {
						try {
							ObjectMapper om = new ObjectMapper();
							String json = om.writeValueAsString(groupsRaw);
							var list = om.readValue(json, new TypeReference<List<VariableAggregatorNodeData.Groups>>() {
							});
							adv.setGroups(list);
						}
						catch (JsonProcessingException e) {
							throw new RuntimeException("Failed to parse 'advanced_settings.groups' JSON", e);
						}
					}
					else {
						adv.setGroups(Collections.emptyList());
					}
				}
				else {
					adv = new VariableAggregatorNodeData.AdvancedSettings().setGroupEnabled(false)
						.setGroups(Collections.emptyList());
				}

				List<List<String>> vars = Collections.emptyList();
				Object varRaw = data.get("variables");
				if (varRaw instanceof List<?>) {
					vars = (List<List<String>>) varRaw;
				}

				String outputTypeStr = (String) data.get("output_type");

View on GitHub (pinned to f82da0b50f)

Solutions

  1. Inspect the cause (JsonProcessingException) to find which group field fails mapping and fix its name/type to match VariableAggregatorNodeData.Groups
  2. Ensure advanced_settings.groups is a JSON array of objects with the fields Groups expects
  3. Remove the advanced_settings.groups block entirely so the converter falls back to an empty list
  4. Align the DSL with a known-good variable-aggregator node export

Example fix

// before
"advanced_settings": {"groups": {"groupId": "g1"}}

// after
"advanced_settings": {"groups": [{"groupId": "g1", "variables": []}]}
Defensive patterns

Strategy: validation

Validate before calling

Object groups = ((Map<String,Object>) ((Map<String,Object>) nodeData.get("advanced_settings"))).get("groups");
if (groups != null && !(groups instanceof List<?> list)) throw new IllegalArgumentException("advanced_settings.groups must be a list");
// optionally round-trip through Jackson to verify Group mapping before import

Type guard

boolean hasValidGroupsShape(Map<String,Object> advancedSettings) { Object g = advancedSettings == null ? null : advancedSettings.get("groups"); return g == null || g instanceof List; }

Try / catch

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; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "failed to unmarshal" / json.Unmarshal errors: why parsing a response into a Go struct fails and how to fix it — this error's family across 23 libraries.

Related errors


AI-assisted analysis of alibaba/spring-ai-alibaba@f82da0b50f (2026-09-09). Data as JSON: /api/errors/34560eb64c5a1fc4. Report an issue: GitHub.