{"record":{"id":"00957177d80a53b9","repo":"apache/seatunnel","slug":"sample-limit-and-sample-print-data-require-d","errorCode":null,"errorMessage":"--sample-limit and --sample-print-data require --dry-run sample.","messagePattern":"--sample-limit and --sample-print-data require --dry-run sample\\.","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":300,"sourceCode":"                || checkConfig\n                || listJob\n                || getRunningJobMetrics\n                || jobId != null\n                || cancelJobId != null\n                || forceCancelJobId != null\n                || metricsJobId != null\n                || checkpointOverviewJobId != null\n                || checkpointHistoryJobId != null\n                || encrypt\n                || decrypt) {\n            throw new ParameterException(\n                    \"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) {","sourceCodeStart":282,"sourceCodeEnd":318,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-core/seatunnel-starter/src/main/java/org/apache/seatunnel/core/starter/seatunnel/args/ClientCommandArgs.java#L282-L318","documentation":"validateSampleOptions() throws this ParameterException when --sample-limit or --sample-print-data is passed without --dry-run sample. These options only configure sample dry-runs, so specifying them with another dry-run mode (or none) is a usage error.","triggerScenarios":"Running `--sample-print-data` alone, `--dry-run static --sample-limit 5`, or any combination where dryRun != SAMPLE but sample options are present.","commonSituations":"Adding sample flags to a normal run or static dry-run; forgetting to add --dry-run sample when tuning sample output.","solutions":["Add --dry-run sample to the command when using --sample-limit/--sample-print-data","Remove --sample-limit/--sample-print-data if you don't intend a sample dry-run"],"exampleFix":"// before\n--sample-limit 5\n// after\n--dry-run sample --sample-limit 5","handlingStrategy":"validation","validationCode":"if ((sampleLimit != null || samplePrintData) && dryRun !== 'sample') {\n  throw new Error('--sample-limit/--sample-print-data require --dry-run sample');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair --sample-limit/--sample-print-data with --dry-run sample","Don't carry sample flags into normal or static dry-run commands"],"tags":["cli","dry-run","missing-flag"],"backgroundTag":"missing-required-flag","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"}