alibaba/spring-ai-alibaba · error · IllegalArgumentException

Invalid write mode: ${dslValue}

Error message

Invalid write mode: ${dslValue}

What it means

Thrown by AssignerNodeData.WriteMode.fromDslValue when the DSL's write-mode string does not match any WriteMode enum value for the given dialect. Indicates an unrecognized assignment mode in an assigner node definition.

Source

Thrown at spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/builder/generator/model/workflow/nodedata/AssignerNodeData.java:86

		INPUT_CONSTANT(type -> switch (type) {
			case DIFY -> "set";
			case STUDIO -> "input";
			default -> UNSUPPORTED;
		});

		private final Function<DSLDialectType, String> dslValue;

		WriteMode(Function<DSLDialectType, String> dslValue) {
			this.dslValue = dslValue;
		}

		public static WriteMode fromDslValue(DSLDialectType dialectType, String dslValue) {
			for (WriteMode mode : WriteMode.values()) {
				if (mode.dslValue.apply(dialectType).equals(dslValue)) {
					return mode;
				}
			}
			throw new IllegalArgumentException("Invalid write mode: " + dslValue);
		}

		@Override
		public String toString() {
			return "AssignerNode.WriteMode." + this.name();
		}

	}

}

View on GitHub (pinned to f82da0b50f)

Solutions

  1. Verify the dslValue matches the canonical value for the given DSLDialectType
  2. Fix typos or casing in the DSL
  3. Re-export the DSL from a compatible version
  4. Extend WriteMode with the new mode if the source platform supports it

Example fix

// before
WriteMode.fromDslValue(DSLDialectType.DIFY, "set-var");
// after
WriteMode.fromDslValue(DSLDialectType.DIFY, "over-write");
Defensive patterns

Strategy: validation

Validate before calling

boolean known = Arrays.stream(WriteMode.values()).anyMatch(m -> m.dslValue.apply(dialectType).equals(dslValue));

Type guard

WriteMode safeWriteMode(DSLDialectType d, String v) { try { return WriteMode.fromDslValue(d, v); } catch (IllegalArgumentException e) { return null; } }

Prevention

When it happens

Trigger: Importing a workflow DSL whose assigner node has a write-mode value (per Dify/Studio dialect) that is misspelled, empty, or from a newer schema version not modeled by the enum.

Common situations: Hand-edited DSL, DSL from a newer Dify release introducing new write modes, dialect mismatch (passing DIFY where STUDIO values are used).

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — 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/8e7bf3dbee36ed2d. Report an issue: GitHub.