{"record":{"id":"1c4903853ca2ec76","repo":"apache/seatunnel","slug":"dry-run-mode-must-not-be-empty","errorCode":null,"errorMessage":"Dry-run mode must not be empty.","messagePattern":"Dry-run mode must not be empty\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-core/seatunnel-starter/src/main/java/org/apache/seatunnel/core/starter/seatunnel/args/ClientCommandArgs.java","lineNumber":229,"sourceCode":"            throw new IllegalArgumentException(blankMessage);\n        }\n        try {\n            Long.parseLong(trimmed);\n        } catch (NumberFormatException e) {\n            throw new IllegalArgumentException(invalidMessagePrefix + value, e);\n        }\n        return trimmed;\n    }\n\n    public DeployMode getDeployMode() {\n        return DeployMode.CLIENT;\n    }\n\n    public static class DryRunConverter implements IStringConverter<DryRun> {\n        @Override\n        public DryRun convert(String value) {\n            if (value == null || value.trim().isEmpty()) {\n                throw new IllegalArgumentException(\"Dry-run mode must not be empty.\");\n            }\n            String trimmed = value.trim();\n            if (DryRun.STATIC.getName().equalsIgnoreCase(trimmed)\n                    || DryRun.STATIC.name().equalsIgnoreCase(trimmed)) {\n                return DryRun.STATIC;\n            }\n            if (DryRun.CONNECT.getName().equalsIgnoreCase(trimmed)\n                    || DryRun.CONNECT.name().equalsIgnoreCase(trimmed)) {\n                return DryRun.CONNECT;\n            }\n            if (DryRun.SAMPLE.getName().equalsIgnoreCase(trimmed)\n                    || DryRun.SAMPLE.name().equalsIgnoreCase(trimmed)) {\n                return DryRun.SAMPLE;\n            }\n            throw new IllegalArgumentException(\n                    \"Unsupported dry-run mode '\"\n                            + value\n                            + \"'. Currently only [static, connect, sample] are supported; shadow\"","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-core/seatunnel-starter/src/main/java/org/apache/seatunnel/core/starter/seatunnel/args/ClientCommandArgs.java#L211-L247","documentation":"ClientCommandArgs.DryRunConverter converts the --dry-run flag value into a DryRun enum. An empty or null value is rejected with IllegalArgumentException 'Dry-run mode must not be empty.' — the flag requires an explicit mode argument (e.g. static). Unsupported mode names produce a different error listing the allowed modes.","triggerScenarios":"Invoking the client with --dry-run and no value (or an empty string value) so the converter receives null/empty input.","commonSituations":"Users expecting --dry-run to be a boolean flag with a default mode; shell scripts interpolating an empty variable into the dry-run argument, e.g. --dry-run $MODE with MODE unset.","solutions":["Provide a mode explicitly: --dry-run static","If the script variable may be empty, default it: MODE=${MODE:-static}","Check supported mode names via the converter's allowed values (e.g. 'static')"],"exampleFix":"// before\n--dry-run\n// after\n--dry-run static","handlingStrategy":"validation","validationCode":"String mode = System.getenv().getOrDefault(\"DRY_RUN_MODE\", \"static\");\nif (mode.trim().isEmpty()) {\n    throw new IllegalArgumentException(\"--dry-run requires a non-empty mode, e.g. static\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    client.submit(args);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"Dry-run mode must not be empty\")) {\n        log.error(\"Supply a mode: --dry-run static\");\n    }\n}","preventionTips":["Always pass a mode with --dry-run (e.g. --dry-run static)","Default shell variables used in the flag: MODE=${MODE:-static}","Don't treat --dry-run as a boolean flag; it requires a value"],"tags":["cli","dry-run","validation"],"backgroundTag":"empty-required-field","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}