apache/seatunnel · warning

insert data failed, retry in smaller chunks

Error message

insert data failed, retry in smaller chunks: {} 

What it means

An insert to Milvus failed with a rate-limit or message-too-large error. Like the upsert path, the writer halves the batch size, splits the data into two halves, and recursively retries each half — without the 60-second sleep used in upsertWrite.

Solutions

  1. Set a smaller batch_size in the Milvus sink config.
  2. Raise Milvus rate limits or proxy max message size on the server.
  3. Throttle source parallelism to reduce insert pressure.
  4. Note this path retries immediately (no backoff sleep); if rate limits persist, add server-side or upstream throttling.

Example fix

// before
sink {
  Milvus {
    batch_size = 10000
  }
}
// after
sink {
  Milvus {
    batch_size = 500
  }
}
Defensive patterns

Strategy: retry

Validate before calling

// keep inserts below max message size
if (estimateBytes(data) > MAX_GRPC_MSG) { splitAndInsert(data); }

Try / catch

try { client.insert(req); }
catch (Exception e) {
    if (isRateLimitOrTooLarge(e)) { insertHalves(data); }
    else throw e;
}

Prevention

When it happens

Trigger: insertWrite catches an exception whose message contains 'rate limit exceeded' or 'received message larger than max' while data.size() > 10.

Common situations: Large initial batches exceeding Milvus message size limits; bursty inserts exceeding Milvus insert rate quotas.

Related errors


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

Appendix: source

Thrown at seatunnel-connectors-v2/connector-milvus/src/main/java/org/apache/seatunnel/connectors/seatunnel/milvus/sink/MilvusBufferBatchWriter.java:329

                        e);
            }
        }
        log.info("upsert data success");
    }

    private void insertWrite(String partitionName, List<JsonObject> data) {
        InsertReq insertReq =
                InsertReq.builder().collectionName(this.collectionName).data(data).build();
        if (StringUtils.isNotEmpty(partitionName)) {
            insertReq.setPartitionName(partitionName);
        }
        try {
            milvusClient.insert(insertReq);
        } catch (Exception e) {
            if (e.getMessage().contains("rate limit exceeded")
                    || e.getMessage().contains("received message larger than max")) {
                if (data.size() > 10) {
                    log.warn("insert data failed, retry in smaller chunks: {} ", data.size() / 2);
                    // Split the data and retry in smaller chunks
                    List<JsonObject> firstHalf = data.subList(0, data.size() / 2);
                    List<JsonObject> secondHalf = data.subList(data.size() / 2, data.size());
                    this.batchSize = this.batchSize / 2;
                    insertWrite(partitionName, firstHalf);
                    insertWrite(partitionName, secondHalf);
                } else {
                    // If the data size is 10, throw the exception to avoid infinite recursion
                    throw new MilvusConnectorException(
                            MilvusConnectionErrorCode.WRITE_DATA_FAIL, "insert data failed", e);
                }
            } else {
                throw new MilvusConnectorException(
                        MilvusConnectionErrorCode.WRITE_DATA_FAIL,
                        "insert data failed with unknown exception",
                        e);
            }
        }

View on GitHub (pinned to cf67b549a7)