{"record":{"id":"03b81535d4b32904","repo":"apache/seatunnel","slug":"end-timestamp-can-t-be-negative","errorCode":null,"errorMessage":"end_timestamp can't be negative","messagePattern":"end_timestamp can't be negative","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-hbase/src/main/java/org/apache/seatunnel/connectors/seatunnel/hbase/client/HbaseClient.java","lineNumber":407,"sourceCode":"            String[] columnNameSplit = columnName.split(\":\");\n            scan.addColumn(Bytes.toBytes(columnNameSplit[0]), Bytes.toBytes(columnNameSplit[1]));\n        }\n        return scan;\n    }\n\n    private static void applyTimeRange(Scan scan, HbaseParameters hbaseParameters)\n            throws IOException {\n        Long startTimestamp = hbaseParameters.getStartTimestamp();\n        Long endTimestamp = hbaseParameters.getEndTimestamp();\n        if (startTimestamp == null && endTimestamp == null) {\n            return;\n        }\n\n        if (startTimestamp != null && startTimestamp < 0) {\n            throw new IllegalArgumentException(\"start_timestamp can't be negative\");\n        }\n        if (endTimestamp != null && endTimestamp < 0) {\n            throw new IllegalArgumentException(\"end_timestamp can't be negative\");\n        }\n\n        long min = startTimestamp == null ? 0L : startTimestamp;\n        long max = endTimestamp == null ? Long.MAX_VALUE : endTimestamp;\n        if (min >= max) {\n            throw new IllegalArgumentException(\"start_timestamp must be less than end_timestamp\");\n        }\n        scan.setTimeRange(min, max);\n    }\n\n    /**\n     * Get a RegionLocator.\n     *\n     * @param tableName table name (preferably fully qualified as {@code namespace:table})\n     * @return RegionLocator\n     * @throws IOException exception\n     * @deprecated Use {@link #getRegionLocator(String, String)} instead to avoid relying on the\n     *     default namespace behavior.","sourceCodeStart":389,"sourceCodeEnd":425,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-hbase/src/main/java/org/apache/seatunnel/connectors/seatunnel/hbase/client/HbaseClient.java#L389-L425","documentation":"The time-range validation in HbaseClient.applyTimeRange rejects a negative end_timestamp, throwing IllegalArgumentException('end_timestamp can't be negative'). HBase time ranges are epoch millis and must be non-negative. The library fails fast during Scan construction rather than sending an invalid range to the cluster.","triggerScenarios":"Configuring option end_timestamp with a negative value that reaches buildScan via applyTimeRange.","commonSituations":"Computing end time as now-minus-offset with a sign error; seconds-vs-millis confusion producing overflow/negatives; placeholder substitution failure.","solutions":["Set end_timestamp to a valid epoch-millisecond value >= 0","Verify the expression that generates the value in your config or scheduler","Omit end_timestamp to default to Long.MAX_VALUE (no upper bound)"],"exampleFix":"// before\nend_timestamp = -1\n// after\nend_timestamp = 1700003600000","handlingStrategy":"validation","validationCode":"Long end = config.getEndTimestamp();\nif (end != null && end < 0) {\n    throw new IllegalArgumentException(\"end_timestamp must be >= 0 (epoch millis)\");\n}","typeGuard":"static boolean validEndTimestamp(Long ts) { return ts == null || ts >= 0; }","tryCatchPattern":"try { client.buildScan(params); }\ncatch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"end_timestamp\")) {\n        // correct the config value before resubmitting\n    } else throw e;\n}","preventionTips":["Compute end times carefully to avoid negative offsets","Use epoch milliseconds consistently","Omit end_timestamp when no upper bound is needed"],"tags":["hbase","validation","timestamp","config"],"backgroundTag":"invalid-argument-value","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"}