alibaba/DataX · error · DorisWriterExcetion

Failed to flush data to Doris, Error label[%s] state[%s]

Error message

Failed to flush data to Doris, Error label[%s] state[%s]

What it means

The Doris FE reported the stream-load label's state as ABORTED. The load identified by 'label' definitively failed and was rolled back, so the observer throws DorisWriterExcetion with needReCreateLabel=true to signal the writer manager that a retry must mint a fresh label (Doris labels are single-use).

Source

Thrown at doriswriter/src/main/java/com/alibaba/datax/plugin/writer/doriswriter/DorisStreamLoadObserver.java:114

                    if (respEntity == null) {
                        throw new IOException(String.format("Failed to flush data to Doris, Error " +
                                "could not get the final state of label[%s].\n", label), null);
                    }
                    Map<String, Object> result = (Map<String, Object>)JSON.parse(EntityUtils.toString(respEntity));
                    String labelState = (String)result.get("data");
                    if (null == labelState) {
                        throw new IOException(String.format("Failed to flush data to Doris, Error " +
                                "could not get the final state of label[%s]. response[%s]\n", label, EntityUtils.toString(respEntity)), null);
                    }
                    LOG.info(String.format("Checking label[%s] state[%s]\n", label, labelState));
                    switch(labelState) {
                        case LAEBL_STATE_VISIBLE:
                        case LAEBL_STATE_COMMITTED:
                            return;
                        case RESULT_LABEL_PREPARE:
                            continue;
                        case RESULT_LABEL_ABORTED:
                            throw new DorisWriterExcetion (String.format("Failed to flush data to Doris, Error " +
                                    "label[%s] state[%s]\n", label, labelState), null, true);
                        case RESULT_LABEL_UNKNOWN:
                        default:
                            throw new IOException(String.format("Failed to flush data to Doris, Error " +
                                    "label[%s] state[%s]\n", label, labelState), null);
                    }
                }
            }
        }
    }

    private byte[] addRows(List<byte[]> rows, int totalBytes) {
        if (Keys.StreamLoadFormat.CSV.equals(options.getStreamLoadFormat())) {
            Map<String, Object> props = (options.getLoadProps() == null ? new HashMap<> () : options.getLoadProps());
            byte[] lineDelimiter = DelimiterParser.parse((String)props.get("line_delimiter"), "\n").getBytes(StandardCharsets.UTF_8);
            ByteBuffer bos = ByteBuffer.allocate(totalBytes + rows.size() * lineDelimiter.length);
            for (byte[] row : rows) {
                bos.put(row);

View on GitHub (pinned to 80ec23d5c5)

Solutions

  1. Check FE audit/BE logs for why the transaction aborted; fix the root cause (schema, BE health, timeouts) rather than relying on retry
  2. Use a unique labelPrefix per job run so retried loads never reuse an aborted label
  3. If retryable (transient BE issue), increase maxRetries in the doriswriter job config so the manager's new-label retry loop can succeed
  4. Verify the target table schema matches the data (column count, types, format CSV/JSON delimiters)

Example fix

// before
"labelPrefix": "datax_job1",
"maxRetries": 0
// after: unique label per run and allow the built-in re-create-label retry
"labelPrefix": "datax_job1_${uuid}",
"maxRetries": 3
Defensive patterns

Strategy: retry

Try / catch

catch (DorisWriterExcetion e) {
    if (e.needReCreateLabel()) {
        // manager already handles this: new label is minted and retried up to maxRetries
        // ensure maxRetries >= 1 in job config so this path can succeed
    }
    throw e;
}

Prevention

When it happens

Trigger: flush() polls the label state; the FE returns state ABORTED (e.g. 'aborted' from the txn). Any load-time error — schema mismatch, BE failure, timeout, duplicate label — that makes the FE abort the transaction lands here. The writer manager catches it, generates a new label via createBatchLabel(), and retries up to maxRetries.

Common situations: Rerunning a job with the same labelPrefix after a partial failure (duplicate/aborted label); BE nodes crashed or out of disk during load; column count/type mismatch between data and Doris table causing BE to abort; load timeout (exec_mem_limit/streaming_label_timeout).

Related errors


AI-assisted analysis of alibaba/DataX@80ec23d5c5 (2026-08-14). Data as JSON: /api/errors/d803b2a39169dfd3. Report an issue: GitHub.