apache/seatunnel · warning

Batch label changed from [%s] to [%s]

Error message

Batch label changed from [%s] to [%s]

What it means

StarRocksSinkManager.flush detects a StarRocksConnectorException with needReCreateLabel() (label conflict, e.g. 'Label [x] has already used'), creates a new batch label, logs this warning about the label change, and updates the tuple so the retry uses the fresh label.

Source

Thrown at seatunnel-connectors-v2/connector-starrocks/src/main/java/org/apache/seatunnel/connectors/seatunnel/starrocks/client/StarRocksSinkManager.java:143

                throw new StarRocksConnectorException(
                        StarRocksConnectorErrorCode.FLUSH_DATA_FAILED,
                        String.format(
                                "Stream Load returned a non-success result for %s.%s with label [%s].",
                                sinkConfig.getDatabase(), sinkConfig.getTable(), tuple.getLabel()));
            } catch (Exception e) {
                log.warn("Writing records to StarRocks failed, retry times = {}", i, e);

                if (i >= sinkConfig.getMaxRetries()) {
                    throw new StarRocksConnectorException(
                            StarRocksConnectorErrorCode.WRITE_RECORDS_FAILED,
                            "The number of retries was exceeded, writing records to StarRocks failed.",
                            e);
                }

                if (e instanceof StarRocksConnectorException
                        && ((StarRocksConnectorException) e).needReCreateLabel()) {
                    String newLabel = createBatchLabel();
                    log.warn(
                            String.format(
                                    "Batch label changed from [%s] to [%s]",
                                    tuple.getLabel(), newLabel));
                    tuple.setLabel(newLabel);
                }

                try {
                    long backoff =
                            Math.min(
                                    sinkConfig.getRetryBackoffMultiplierMs() * i,
                                    sinkConfig.getMaxRetryBackoffMs());
                    Thread.sleep(backoff);
                } catch (InterruptedException ex) {
                    Thread.currentThread().interrupt();
                    throw new StarRocksConnectorException(
                            StarRocksConnectorErrorCode.FLUSH_DATA_FAILED,
                            "Interrupted while waiting to retry Stream Load.",
                            ex);

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Verify in StarRocks (SHOW STREAM LOAD) whether the old label actually succeeded — data may already be loaded
  2. Ensure label generation includes enough uniqueness (timestamp/uuid)
  3. If data was already committed with the old label, avoid double-loading downstream
  4. Keep default needReCreateLabel behavior and monitor label-change warnings for frequency

Example fix

// before
String label = String.format("seatunnel_%s_%d", table, batchId);
// after
String label = String.format("seatunnel_%s_%d_%s", table, batchId, UUID.randomUUID());
Defensive patterns

Strategy: retry

Validate before calling

// Check whether the previous label already committed before re-loading
// curl -u user:pass http://fe:8030/api/{db}/_stream_load_state?label={label}
// Or in StarRocks: SHOW STREAM LOAD WHERE LABEL = "old-label";

Try / catch

try {
    sinkManager.flush();
} catch (StarRocksConnectorException e) {
    if (e.needReCreateLabel()) {
        // verify old label state in StarRocks to avoid double-loading
        tuple.setLabel(createBatchLabel());
    }
}

Prevention

When it happens

Trigger: flush() retry loop catches an exception where the previous stream load label was already committed/used in StarRocks — label collision from a previous identical label, duplicate flush after retry, or job restart reusing an old label.

Common situations: Retried flush after a timeout where the first load actually succeeded; deterministic label generation colliding across retries; concurrent jobs with identical label prefixes.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/11aa808873e1e9e5. Report an issue: GitHub.