alibaba/DataX · error · RuntimeException
no such mode :
Error message
no such mode :
What it means
ExecuteMode.toExecuteMode maps a mode string to the enum values STANDALONE("standalone"), LOCAL("local"), DISTRIBUTE("distribute") using exact case-sensitive equals, and throws this RuntimeException for any other string — including differently-cased variants like "Distribute" or "STANDALONE", since only the isLocal/isDistribute helpers are case-insensitive.
Source
Thrown at core/src/main/java/com/alibaba/datax/dataxservice/face/domain/enums/ExecuteMode.java:38
public String getValue() {
return this.value;
}
public static boolean isLocal(String mode) {
return equalsIgnoreCase(LOCAL.getValue(), mode);
}
public static boolean isDistribute(String mode) {
return equalsIgnoreCase(DISTRIBUTE.getValue(), mode);
}
public static ExecuteMode toExecuteMode(String modeName) {
for (ExecuteMode mode : ExecuteMode.values()) {
if (mode.value().equals(modeName)) {
return mode;
}
}
throw new RuntimeException("no such mode :" + modeName);
}
private static boolean equalsIgnoreCase(String str1, String str2) {
return str1 == null ? str2 == null : str1.equalsIgnoreCase(str2);
}
@Override
public String toString() {
return this.value;
}
}
View on GitHub (pinned to 80ec23d5c5)
Solutions
- Set the mode string to exactly one of: "standalone", "local", "distribute" (all lowercase).
- Check the config key that feeds toExecuteMode is present and not null.
- If a new mode is genuinely needed, add it to the ExecuteMode enum values rather than passing an unknown string.
- Guard the call site with ExecuteMode.isLocal/isDistribute (case-insensitive) when only a boolean decision is needed.
Example fix
// before
ExecuteMode mode = ExecuteMode.toExecuteMode(cfg.get("mode")); // "Distribute" throws
// after
ExecuteMode mode = ExecuteMode.toExecuteMode(
cfg.get("mode") == null ? "standalone" : cfg.get("mode").toLowerCase()); Defensive patterns
Strategy: validation
Validate before calling
private static final Set<String> VALID = Set.of("standalone", "local", "distribute");
String mode = cfg.get("mode");
if (mode == null || !VALID.contains(mode.toLowerCase())) throw new IllegalArgumentException("mode must be one of " + VALID); Type guard
boolean isValidExecuteMode(String s) { return s != null && Arrays.stream(ExecuteMode.values()).anyMatch(m -> m.value().equals(s)); } Prevention
- Normalize case (toLowerCase) before calling toExecuteMode.
- Fail fast at config load with an explicit valid-values message instead of hitting the enum loop.
When it happens
Trigger: Calling ExecuteMode.toExecuteMode("StandAlone") or any value outside {"standalone","local","distribute"}, e.g. from dataxservice/admin when the deploy mode configuration key is misspelled or has different casing. A null input also fails the equals loop and throws with 'no such mode :null'.
Common situations: Editing the dataxservice deploy configuration and changing the mode value's case, passing null because the config key is absent, or introducing a new mode name without extending the enum.
Related errors
- 您提供的配置文件有误. 路径[%s]需要配置Json格式的Map对象,但该节点发现实际类型是[%s]. 请检查您的配置并
- 您提供的配置文件有误. 路径[%s]值为null,datax无法识别该配置. 请检查您的配置并作出修改.
- The length is not an even number
- 您提供的作业配置有误, List不能为空.
- dx_pad first para(%s) support l or r
AI-assisted analysis of alibaba/DataX@80ec23d5c5 (2026-08-14).
Data as JSON: /api/errors/4520acf9b584c52f.
Report an issue: GitHub.