{"record":{"id":"4520acf9b584c52f","repo":"alibaba/DataX","slug":"no-such-mode","errorCode":null,"errorMessage":"no such mode :","messagePattern":"no such mode :","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/com/alibaba/datax/dataxservice/face/domain/enums/ExecuteMode.java","lineNumber":38,"sourceCode":"    public String getValue() {\n        return this.value;\n    }\n\n    public static boolean isLocal(String mode) {\n        return equalsIgnoreCase(LOCAL.getValue(), mode);\n    }\n\n    public static boolean isDistribute(String mode) {\n        return equalsIgnoreCase(DISTRIBUTE.getValue(), mode);\n    }\n\n    public static ExecuteMode toExecuteMode(String modeName) {\n        for (ExecuteMode mode : ExecuteMode.values()) {\n            if (mode.value().equals(modeName)) {\n                return mode;\n            }\n        }\n        throw new RuntimeException(\"no such mode :\" + modeName);\n    }\n\n    private static boolean equalsIgnoreCase(String str1, String str2) {\n        return str1 == null ? str2 == null : str1.equalsIgnoreCase(str2);\n    }\n\n    @Override\n    public String toString() {\n        return this.value;\n    }\n}\n","sourceCodeStart":20,"sourceCodeEnd":50,"githubUrl":"https://github.com/alibaba/DataX/blob/80ec23d5c5328eb90ca364d2749e92dfaf44541e/core/src/main/java/com/alibaba/datax/dataxservice/face/domain/enums/ExecuteMode.java#L20-L50","documentation":"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.","triggerScenarios":"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'.","commonSituations":"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.","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."],"exampleFix":"// before\nExecuteMode mode = ExecuteMode.toExecuteMode(cfg.get(\"mode\")); // \"Distribute\" throws\n// after\nExecuteMode mode = ExecuteMode.toExecuteMode(\n    cfg.get(\"mode\") == null ? \"standalone\" : cfg.get(\"mode\").toLowerCase());","handlingStrategy":"validation","validationCode":"private static final Set<String> VALID = Set.of(\"standalone\", \"local\", \"distribute\");\nString mode = cfg.get(\"mode\");\nif (mode == null || !VALID.contains(mode.toLowerCase())) throw new IllegalArgumentException(\"mode must be one of \" + VALID);","typeGuard":"boolean isValidExecuteMode(String s) { return s != null && Arrays.stream(ExecuteMode.values()).anyMatch(m -> m.value().equals(s)); }","tryCatchPattern":null,"preventionTips":["Normalize case (toLowerCase) before calling toExecuteMode.","Fail fast at config load with an explicit valid-values message instead of hitting the enum loop."],"tags":["datax","dataxservice","configuration","enum"],"backgroundTag":null,"analyzedSha":"80ec23d5c5328eb90ca364d2749e92dfaf44541e","analyzedAt":"2026-08-14T15:33:51.187Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}