{"record":{"id":"3af5ac65f0774668","repo":"apache/seatunnel","slug":"name-must-be-greater-than-zero","errorCode":null,"errorMessage":"${name} must be greater than zero.","messagePattern":"(.+?) must be greater than zero\\.","errorType":"validation","errorClass":"ParameterException","httpStatus":null,"severity":"error","filePath":"seatunnel-core/seatunnel-starter/src/main/java/org/apache/seatunnel/core/starter/seatunnel/args/ClientCommandArgs.java","lineNumber":312,"sourceCode":"                    \"Sample dry-run mode cannot be combined with validation, job control, restore, savepoint, encryption, or decryption options.\");\n        }\n    }\n\n    private void validateSampleOptions() {\n        if (dryRun != DryRun.SAMPLE && (sampleLimit != null || samplePrintData)) {\n            throw new ParameterException(\n                    \"--sample-limit and --sample-print-data require --dry-run sample.\");\n        }\n    }\n\n    /** Validates that a sample limit is between 1 and {@link DryRunSampleConfig#MAX_LIMIT}. */\n    public static class PositiveIntegerValidator implements IParameterValidator {\n        @Override\n        public void validate(String name, String value) throws ParameterException {\n            try {\n                int limit = Integer.parseInt(value);\n                if (limit < 1) {\n                    throw new ParameterException(name + \" must be greater than zero.\");\n                }\n                if (limit > DryRunSampleConfig.MAX_LIMIT) {\n                    throw new ParameterException(\n                            name + \" must not exceed \" + DryRunSampleConfig.MAX_LIMIT + \".\");\n                }\n            } catch (NumberFormatException e) {\n                throw new ParameterException(name + \" must be an integer.\", e);\n            }\n        }\n    }\n\n    public static class SeaTunnelMasterTargetConverter implements IStringConverter<MasterType> {\n        private static final List<MasterType> MASTER_TYPE_LIST = new ArrayList<>();\n\n        static {\n            MASTER_TYPE_LIST.add(MasterType.LOCAL);\n            MASTER_TYPE_LIST.add(MasterType.CLUSTER);\n        }","sourceCodeStart":294,"sourceCodeEnd":330,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-core/seatunnel-starter/src/main/java/org/apache/seatunnel/core/starter/seatunnel/args/ClientCommandArgs.java#L294-L330","documentation":"PositiveIntegerValidator.validate() throws this ParameterException when the value of --sample-limit parses as an integer but is less than 1. The validator enforces the range [1, DryRunSampleConfig.MAX_LIMIT] before the command proceeds.","triggerScenarios":"Running `--dry-run sample --sample-limit 0` or `--sample-limit -3`.","commonSituations":"Trying to disable sampling by passing 0; programmatically computed limits that default to 0.","solutions":["Set --sample-limit to at least 1","Remove --sample-limit to use the default limit instead of 0"],"exampleFix":"// before\n--sample-limit 0\n// after\n--sample-limit 1","handlingStrategy":"validation","validationCode":"const limit = Number.parseInt(value, 10);\nif (Number.isInteger(limit) && limit < 1) {\n  throw new Error('--sample-limit must be >= 1');\n}","typeGuard":null,"tryCatchPattern":"try {\n  seatunnel.run(args);\n} catch (ParameterException e) {\n  if (e.getMessage().endsWith('must be greater than zero.')) {\n    // clamp and retry with a valid limit\n  }\n}","preventionTips":["Use values >= 1 for --sample-limit","Do not use 0 as a sentinel to disable sampling - omit the flag instead"],"tags":["cli","validation","out-of-range"],"backgroundTag":"value-out-of-range","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"}