{"record":{"id":"197d166c8925ad11","repo":"apache/seatunnel","slug":"unsupported-deploy-mode-deploymode","errorCode":null,"errorMessage":"Unsupported deploy mode: ${deployMode}","messagePattern":"Unsupported deploy mode: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-core/seatunnel-core-starter/src/main/java/org/apache/seatunnel/core/starter/utils/FileUtils.java","lineNumber":54,"sourceCode":"\n    /**\n     * Get the seatunnel config path. In client mode, the path to the config file is directly given\n     * by user. In cluster mode, the path to the config file is the `executor path/config file\n     * name`.\n     *\n     * @param args args\n     * @return path of the seatunnel config file.\n     */\n    public static Path getConfigPath(@NonNull AbstractCommandArgs args) {\n        switch (args.getDeployMode()) {\n            case RUN:\n            case CLIENT:\n                return Paths.get(args.getConfigFile());\n            case RUN_APPLICATION:\n            case CLUSTER:\n                return Paths.get(getFileName(args.getConfigFile()));\n            default:\n                throw new IllegalArgumentException(\n                        \"Unsupported deploy mode: \" + args.getDeployMode());\n        }\n    }\n\n    /**\n     * Check whether the conf file exists.\n     *\n     * @param configFile the path of the config file\n     */\n    public static void checkConfigExist(Path configFile) {\n        if (!configFile.toFile().exists()) {\n            throw CommonError.fileNotExistFailed(\"SeaTunnel\", \"read\", configFile.toString());\n        }\n    }\n\n    /**\n     * Get the file name from the given path. e.g. seatunnel/conf/config.conf -> config.conf\n     *","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-core/seatunnel-core-starter/src/main/java/org/apache/seatunnel/core/starter/utils/FileUtils.java#L36-L72","documentation":"IllegalArgumentException thrown by FileUtils.getConfigPath when the deploy mode of the command args is not one of the explicitly handled modes (CLIENT, RUN_APPLICATION, CLUSTER). The switch has no branch for the mode, so the library cannot decide whether to use the config file path as-is or only its file name, and fails fast.","triggerScenarios":"Calling FileUtils.getConfigPath with SeaTunnelCommandArgs whose getDeployMode() returns an unhandled enum value — typically after a new DeployMode enum constant was added without updating this switch, or a null/custom deploy mode injected programmatically.","commonSituations":"Developers extending the starter with a new deploy mode; tests constructing args with an unusual DeployMode; version upgrades where enum and switch got out of sync.","solutions":["Use a supported deploy mode (client, cluster, run-application)","If adding a new DeployMode constant, add a case for it in getConfigPath","Inspect args.getDeployMode() before calling to confirm it is one of CLIENT/RUN_APPLICATION/CLUSTER"],"exampleFix":"// before\nDeployMode mode = DeployMode.YARN_APPLICATION; // unhandled\n// after\nargs.setDeployMode(DeployMode.CLIENT); // or add a case for the new mode","handlingStrategy":"type-guard","validationCode":"if (deployMode != DeployMode.CLIENT && deployMode != DeployMode.CLUSTER && deployMode != DeployMode.RUN_APPLICATION) {\n    throw new IllegalArgumentException(\"Mode not supported by getConfigPath\");\n}","typeGuard":"boolean isHandled(DeployMode m) {\n    return m == DeployMode.CLIENT || m == DeployMode.CLUSTER || m == DeployMode.RUN_APPLICATION;\n}","tryCatchPattern":"try {\n    path = FileUtils.getConfigPath(args);\n} catch (IllegalArgumentException e) {\n    log.error(\"Deploy mode {} not handled\", args.getDeployMode(), e);\n}","preventionTips":["Keep the getConfigPath switch in sync when adding DeployMode constants","Add unit tests covering every DeployMode enum value","Avoid constructing command args with null/custom deploy modes"],"tags":["deploy-mode","cli","internal"],"backgroundTag":"invalid-enum-value","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}