apache/seatunnel · error
Writing records to StarRocks failed, retry times = {}
Error message
Writing records to StarRocks failed, retry times = {} What it means
StarRocksSinkManager.flush retries stream load writes; on each failed attempt it logs this warning with the retry counter. When the retry count reaches sinkConfig.getMaxRetries(), it rethrows StarRocksConnectorException (WRITE_RECORDS_FAILED), failing the write.
Source
Thrown at seatunnel-connectors-v2/connector-starrocks/src/main/java/org/apache/seatunnel/connectors/seatunnel/starrocks/client/StarRocksSinkManager.java:131
new StarRocksFlushTuple(
createBatchLabel(), batchBytesSize, new ArrayList<>(batchList));
}
StarRocksFlushTuple tuple = pendingFlush;
boolean loadSucceeded = false;
for (int i = 0; i <= sinkConfig.getMaxRetries(); i++) {
try {
Boolean successFlag = starrocksStreamLoadVisitor.doStreamLoad(tuple);
if (Boolean.TRUE.equals(successFlag)) {
loadSucceeded = true;
break;
}
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);
}
View on GitHub (pinned to cf67b549a7)
Solutions
- Inspect the wrapped exception for the root cause (HTTP code, load response)
- Increase sink max-retries in the StarRocks connector config
- Verify StarRocks cluster health and capacity
- Check label conflict messages; use needReCreateLabel handling to regenerate labels
Example fix
// before
StarRocksSinkOptions.MAX_RETRIES default (e.g. 3) with flaky network
// after
sink = {
StarRocksSinkProperties...
"max-retries" = "10"
} Defensive patterns
Strategy: retry
Validate before calling
// Before the job, verify cluster and endpoint health
if (!httpHelper.tryHttpConnection(feHost)) {
throw new IllegalStateException("StarRocks FE unreachable");
}
// Confirm stream load endpoint responds:
// curl -u user:pass -i http://fe:8030/api/{db}/{table}/_stream_load Try / catch
try {
sinkManager.flush();
} catch (StarRocksConnectorException e) {
if (e.getErrorCode() == StarRocksConnectorErrorCode.WRITE_RECORDS_FAILED) {
logger.error("Retries exhausted writing to StarRocks: {}", e.getMessage(), e);
// inspect root cause before restarting the job
}
throw e;
} Prevention
- Tune max-retries for your network reliability profile
- Monitor StarRocks cluster health/capacity before large loads
- Check label conflicts and load responses in the root-cause exception
- Ensure stable connectivity between SeaTunnel workers and FE/BE
When it happens
Trigger: flush() invoked (from write/close) while the underlying stream load attempt throws — HTTP failures, non-success load result, network errors — and the retry loop iterates.
Common situations: StarRocks cluster overloaded or down; label conflicts; incorrect stream load URL or auth; network partitions during load; too-low max-retries for transient outages.
Related errors
- FLUSH_DATA_FAILED
- Batch label changed from [%s] to [%s]
- WRITE_RECORDS_FAILED
- FLUSH_DATA_FAILED
- Request failed with code:{}, err:{}
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/8ba64af991232faa.
Report an issue: GitHub.