apache/seatunnel · warning

Could not calculate standalone splits

Error message

Could not calculate standalone splits: {}, fallback to SampleSplitter

What it means

SplitVectorSplitStrategy executed splitVector successfully at the transport level but the response's 'ok' flag is false (isCommandSucceed fails). It logs this warning with the response's errmsg and falls back to SampleBucketSplitter — the server declined to compute split keys.

Solutions

  1. Check the errmsg value in the log for the exact server-side rejection reason.
  2. Correct keyPattern/chunkSizeMB parameters to match the collection's shard key and valid size range.
  3. Test the command manually in mongosh to reproduce the errmsg.
  4. Fall back intentionally by configuring SampleSplitter as the strategy.
Defensive patterns

Strategy: validation

Validate before calling

// dry-run splitVector and inspect ok/errmsg
const r = db.runCommand({splitVector: 'mydb.mycoll', keyPattern: {userId: 1}, maxChunkSizeBytes: 64*1024*1024});
if (r.ok !== 1) print('splitVector rejected: ' + r.errmsg);

Prevention

When it happens

Trigger: split() receives a BsonDocument result from splitVector where ok != 1 and errmsg is set, e.g. the server rejects the keyPattern or chunk size even though no exception was thrown.

Common situations: Command responded with errmsg like 'keyPattern must match shard key' or size validation errors on mongos; older server versions returning ok:0 instead of throwing.

Understand the failure class

Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-mongodb/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/mongodb/source/splitters/SplitVectorSplitStrategy.java:79

        BsonDocument splitResult;
        try {
            splitResult = splitVector(mongoClient, collectionId, keyPattern, chunkSizeMB);
        } catch (MongoCommandException e) {
            if (e.getErrorCode() == UNAUTHORIZED_ERROR) {
                log.warn(
                        "Unauthorized to execute splitVector command: {}, fallback to SampleSplitter",
                        e.getErrorMessage());
            } else {
                log.warn(
                        "Execute splitVector command failed: {}, fallback to SampleSplitter",
                        e.getErrorMessage());
            }
            return SampleBucketSplitStrategy.INSTANCE.split(splitContext);
        }

        if (!isCommandSucceed(splitResult)) {
            log.warn(
                    "Could not calculate standalone splits: {}, fallback to SampleSplitter",
                    splitResult.getString("errmsg"));
            return SampleBucketSplitStrategy.INSTANCE.split(splitContext);
        }

        BsonArray splitKeys = splitResult.getArray("splitKeys");
        if (CollectionUtils.isEmpty(splitKeys)) {
            // documents size is less than chunk size, treat the entire collection as single chunk.
            return SingleSplitStrategy.INSTANCE.split(splitContext);
        }

        SeaTunnelRowType rowType = shardKeysToRowType(Collections.singleton(ID_FIELD));
        List<SnapshotSplit> snapshotSplits = new ArrayList<>(splitKeys.size() + 1);

        BsonValue lowerValue = new BsonMinKey();
        ;
        for (int i = 0; i < splitKeys.size(); i++) {
            BsonValue splitKeyValue = splitKeys.get(i).asDocument().get(ID_FIELD);

View on GitHub (pinned to cf67b549a7)