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

Invalid config!

Error message

Invalid config!

What it means

Thrown by StudioDSLAdapter.validateDSLData when Jackson's OBJECT_MAPPER.convertValue fails to deserialize the 'config' map into a WorkflowConfig object. The config exists but its internal shape does not match the WorkflowConfig schema — wrong field types, unknown required structure, or malformed nested nodes/edges. The original Jackson exception is swallowed, so the message omits the underlying reason.

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:322

	@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) {
		return DSLDialectType.STUDIO.equals(dialectType);
	}

}

View on GitHub (pinned to f82da0b50f)

Solutions

  1. Run OBJECT_MAPPER.convertValue(config, WorkflowConfig.class) yourself and log the Jackson exception to see the exact mismatching field
  2. Compare your config against a freshly exported Studio workflow DSL and align the schema
  3. Fix field types in config (lists vs maps, string vs number) to match WorkflowConfig
  4. Re-export from the same Studio version as the admin runtime to avoid schema drift

Example fix

// before
{"config": {"nodes": {"0": {...}}}}

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

Strategy: validation

Validate before calling

try {
    new ObjectMapper().convertValue(dslData.get("config"), WorkflowConfig.class);
} catch (IllegalArgumentException e) {
    throw new IllegalStateException("config does not match WorkflowConfig schema: " + e.getMessage());
}

Type guard

boolean isWorkflowConfigShape(Object config) { try { OBJECT_MAPPER.convertValue(config, WorkflowConfig.class); return true; } catch (Exception e) { return false; } }

Try / catch

try { studioAdapter.importDSL(data); } catch (IllegalArgumentException e) { if ("Invalid config!".equals(e.getMessage())) { // reproduce locally to see Jackson's real error
    OBJECT_MAPPER.convertValue(data.get("config"), WorkflowConfig.class); } throw e; }

Prevention

When it happens

Trigger: config present but with fields of wrong types (e.g. nodes as a map instead of a list); config from an older/newer Studio version whose schema diverged from WorkflowConfig; hand-authored config missing required WorkflowConfig properties or containing type-incompatible values.

Common situations: Migrating DSLs across Studio versions with schema changes; manual edits to nodes/edges introducing type errors; programmatically built config maps that don't mirror WorkflowConfig fields.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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