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

config is null

Error message

config is null

What it means

Thrown by StudioDSLAdapter.validateDSLData as IllegalArgumentException when the 'config' object is absent from the workflow DSL. After checking type=='workflow', the adapter deep-reads 'config' and requires it to exist because it holds the entire workflow definition (nodes, edges, metadata).

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/adapters/StudioDSLAdapter.java:314

	public ChatBot mapToChatBot(Map<String, Object> data) {
		throw new UnsupportedOperationException();
	}

	@Override
	public Map<String, Object> chatbotToMap(ChatBot chatBot) {
		throw new UnsupportedOperationException();
	}

	@Override
	public void validateDSLData(Map<String, Object> data) {
		String type = MapReadUtil.getMapDeepValue(data, String.class, "type");
		if (!"workflow".equalsIgnoreCase(type)) {
			throw new UnsupportedOperationException("Unsupported type: " + type);
		}

		Map<?, ?> config = MapReadUtil.getMapDeepValue(data, Map.class, "config");
		if (config == null) {
			throw new IllegalArgumentException("config is null");
		}

		// 检查config是否为WorkflowConfig
		try {
			OBJECT_MAPPER.convertValue(config, WorkflowConfig.class);
		}
		catch (Exception e) {
			throw new IllegalArgumentException("Invalid config!");
		}
	}

	@Override
	public Serializer getSerializer() {
		return this.serializer;
	}

	@Override
	public Boolean supportDialect(DSLDialectType dialectType) {

View on GitHub (pinned to f82da0b50f)

Solutions

  1. Add the 'config' object containing the workflow definition to the DSL map
  2. Re-export the workflow from Studio to get a complete document
  3. Verify the config key path matches what MapReadUtil.getMapDeepValue(data, Map.class, "config") expects
  4. Validate the JSON structure of your export against a known-good Studio workflow DSL

Example fix

// before
{"type": "workflow"}

// after
{"type": "workflow", "config": {"nodes": [...], "edges": [...]}}
Defensive patterns

Strategy: validation

Validate before calling

if (dslData.get("config") == null) {
    throw new IllegalArgumentException("Studio workflow DSL requires a 'config' object");
}

Type guard

boolean hasConfig(Map<String,Object> dsl) { return dsl.get("config") instanceof Map; }

Try / catch

try { studioAdapter.importDSL(data); } catch (IllegalArgumentException e) { if ("config is null".equals(e.getMessage())) { log.error("DSL dropped its 'config' block; re-export the workflow"); } throw e; }

Prevention

When it happens

Trigger: Importing a Studio workflow DSL that contains type but no 'config' key; config nested at a different path than the deep lookup expects; config explicitly set to null; partial DSL assembled programmatically without the config block.

Common situations: Hand-trimmed export files; preprocessed DSL where config was moved or renamed; writing DSL maps in code and forgetting the config payload; export interrupted/corrupted so config was dropped.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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