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

  1. Set the mode string to exactly one of: "standalone", "local", "distribute" (all lowercase).
  2. Check the config key that feeds toExecuteMode is present and not null.
  3. If a new mode is genuinely needed, add it to the ExecuteMode enum values rather than passing an unknown string.
  4. 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

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


AI-assisted analysis of alibaba/DataX@80ec23d5c5 (2026-08-14). Data as JSON: /api/errors/4520acf9b584c52f. Report an issue: GitHub.