{"record":{"id":"8ba64af991232faa","repo":"apache/seatunnel","slug":"writing-records-to-starrocks-failed-retry-times","errorCode":null,"errorMessage":"Writing records to StarRocks failed, retry times = {}","messagePattern":"Writing records to StarRocks failed, retry times = (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-starrocks/src/main/java/org/apache/seatunnel/connectors/seatunnel/starrocks/client/StarRocksSinkManager.java","lineNumber":131,"sourceCode":"                    new StarRocksFlushTuple(\n                            createBatchLabel(), batchBytesSize, new ArrayList<>(batchList));\n        }\n        StarRocksFlushTuple tuple = pendingFlush;\n        boolean loadSucceeded = false;\n        for (int i = 0; i <= sinkConfig.getMaxRetries(); i++) {\n            try {\n                Boolean successFlag = starrocksStreamLoadVisitor.doStreamLoad(tuple);\n                if (Boolean.TRUE.equals(successFlag)) {\n                    loadSucceeded = true;\n                    break;\n                }\n                throw new StarRocksConnectorException(\n                        StarRocksConnectorErrorCode.FLUSH_DATA_FAILED,\n                        String.format(\n                                \"Stream Load returned a non-success result for %s.%s with label [%s].\",\n                                sinkConfig.getDatabase(), sinkConfig.getTable(), tuple.getLabel()));\n            } catch (Exception e) {\n                log.warn(\"Writing records to StarRocks failed, retry times = {}\", i, e);\n\n                if (i >= sinkConfig.getMaxRetries()) {\n                    throw new StarRocksConnectorException(\n                            StarRocksConnectorErrorCode.WRITE_RECORDS_FAILED,\n                            \"The number of retries was exceeded, writing records to StarRocks failed.\",\n                            e);\n                }\n\n                if (e instanceof StarRocksConnectorException\n                        && ((StarRocksConnectorException) e).needReCreateLabel()) {\n                    String newLabel = createBatchLabel();\n                    log.warn(\n                            String.format(\n                                    \"Batch label changed from [%s] to [%s]\",\n                                    tuple.getLabel(), newLabel));\n                    tuple.setLabel(newLabel);\n                }\n","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-starrocks/src/main/java/org/apache/seatunnel/connectors/seatunnel/starrocks/client/StarRocksSinkManager.java#L113-L149","documentation":"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.","triggerScenarios":"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.","commonSituations":"StarRocks cluster overloaded or down; label conflicts; incorrect stream load URL or auth; network partitions during load; too-low max-retries for transient outages.","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"],"exampleFix":"// before\nStarRocksSinkOptions.MAX_RETRIES default (e.g. 3) with flaky network\n// after\nsink = {\n  StarRocksSinkProperties...\n  \"max-retries\" = \"10\"\n}","handlingStrategy":"retry","validationCode":"// Before the job, verify cluster and endpoint health\nif (!httpHelper.tryHttpConnection(feHost)) {\n    throw new IllegalStateException(\"StarRocks FE unreachable\");\n}\n// Confirm stream load endpoint responds:\n// curl -u user:pass -i http://fe:8030/api/{db}/{table}/_stream_load","typeGuard":null,"tryCatchPattern":"try {\n    sinkManager.flush();\n} catch (StarRocksConnectorException e) {\n    if (e.getErrorCode() == StarRocksConnectorErrorCode.WRITE_RECORDS_FAILED) {\n        logger.error(\"Retries exhausted writing to StarRocks: {}\", e.getMessage(), e);\n        // inspect root cause before restarting the job\n    }\n    throw e;\n}","preventionTips":["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"],"tags":["starrocks","retry","stream-load"],"backgroundTag":"retry-limit-exceeded","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"}