{"record":{"id":"19c669bbb785be12","repo":"apache/seatunnel","slug":"state-cleanup-delay-millis-must-be-0","errorCode":null,"errorMessage":"${STATE_CLEANUP_DELAY_MILLIS} must be >= 0","messagePattern":"(.+?) must be >= 0","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-engine/seatunnel-engine-common/src/main/java/org/apache/seatunnel/engine/common/config/EngineConfig.java","lineNumber":196,"sourceCode":"        this.reportNonTerminalJobState = reportNonTerminalJobState;\n    }\n\n    public void setTaskExecutionThreadShareMode(ThreadShareMode taskExecutionThreadShareMode) {\n        checkNotNull(queueType);\n        this.taskExecutionThreadShareMode = taskExecutionThreadShareMode;\n    }\n\n    public void setHistoryJobExpireMinutes(int historyJobExpireMinutes) {\n        checkPositive(\n                historyJobExpireMinutes,\n                ServerConfigOptions.MasterServerConfigOptions.HISTORY_JOB_EXPIRE_MINUTES\n                        + \" must be > 0\");\n        this.historyJobExpireMinutes = historyJobExpireMinutes;\n    }\n\n    public void setStateCleanupDelayMillis(long stateCleanupDelayMillis) {\n        if (stateCleanupDelayMillis < 0) {\n            throw new IllegalArgumentException(\n                    ServerConfigOptions.MasterServerConfigOptions.STATE_CLEANUP_DELAY_MILLIS\n                            + \" must be >= 0\");\n        }\n        this.stateCleanupDelayMillis = stateCleanupDelayMillis;\n    }\n\n    public EngineConfig setQueueType(QueueType queueType) {\n        checkNotNull(queueType);\n        this.queueType = queueType;\n        return this;\n    }\n\n    public enum ClusterRole {\n        MASTER_AND_WORKER,\n        MASTER,\n        WORKER\n    }\n","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-engine/seatunnel-engine-common/src/main/java/org/apache/seatunnel/engine/common/config/EngineConfig.java#L178-L214","documentation":"EngineConfig.setStateCleanupDelayMillis validates that stateCleanupDelayMillis is non-negative before storing it; a negative value in the engine YAML or a direct setter call throws IllegalArgumentException naming the STATE_CLEANUP_DELAY_MILLIS option.","triggerScenarios":"Master's seatunnel.yaml sets the state-cleanup delay key to a negative number, or parseEngineConfig / a test calls setStateCleanupDelayMillis with a negative long.","commonSituations":"-1 intended as 'disabled'; negative value emitted by a config generator; unit confusion when hand-editing durations.","solutions":["Set the delay to a non-negative value (e.g. 60000) in the engine config.","Remove the key to use the built-in default.","To effectively disable cleanup, use a very large positive value instead of a negative one."],"exampleFix":"# before\nstate-cleanup:\n  delay-millis: -1\n# after\nstate-cleanup:\n  delay-millis: 60000","handlingStrategy":"validation","validationCode":"long v = Long.parseLong(props.getProperty(\"state-cleanup.delay-millis\", \"0\"));\nif (v < 0) throw new IllegalArgumentException(\"state-cleanup.delay-millis must be >= 0, got \" + v);","typeGuard":null,"tryCatchPattern":"try {\n    engineConfig.setStateCleanupDelayMillis(v);\n} catch (IllegalArgumentException e) {\n    throw new ConfigValidationException(\"invalid state-cleanup delay: \" + v, e);\n}","preventionTips":["Validate numeric config fields with a schema before applying.","Never use negatives to mean 'disabled'; omit the key or use a large positive.","Unit-test parsing of your production seatunnel.yaml."],"tags":["config","validation","engine"],"backgroundTag":"invalid-config-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"}