apache/seatunnel · warning

Execute splitVector command failed

Error message

Execute splitVector command failed: {}, fallback to SampleSplitter

What it means

SplitVectorSplitStrategy caught a MongoCommandException whose error code is not 13 while executing the splitVector command. It logs this warning with the server's error message and falls back to SampleBucketSplitter. The command itself failed for a non-authorization reason (bad keyPattern, size limits, unsupported cluster).

Solutions

  1. Read the logged server error message to identify the command failure reason.
  2. Verify keyPattern matches the collection's actual shard/index key.
  3. On sharded clusters, ensure splitVector is supported through your topology/driver version.
  4. Switch to the SampleSplitter strategy if splitVector is unsupported in your environment.

Example fix

// before: keyPattern field not part of shard key
keyPattern = new Document("nonIndexedField", 1)
// after: use the shard key
keyPattern = new Document("userId", 1)
Defensive patterns

Strategy: validation

Validate before calling

// verify keyPattern matches the shard key
const md = db.getSiblingDB('config').collections.findOne({_id: 'mydb.mycoll'});
printjson(md && md.key); // use exactly this in the split config

Prevention

When it happens

Trigger: splitVector(mongoClient, collectionId, keyPattern, chunkSizeMB) throws MongoCommandException with code != 13 — e.g. code 2 (BadValue) for an invalid keyPattern, unsupported command on the topology, or invalid maxChunkSizeMB.

Common situations: Running splitVector against mongos in some versions (must target shards directly); wrong shard-key field in keyPattern config; chunkSizeMB set outside allowed bounds; standalone/replica-set deployment without sharding support.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/9230555e485eea7f. 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:71

    @Override
    public Collection<SnapshotSplit> split(@Nonnull SplitContext splitContext) {
        MongoClient mongoClient = splitContext.getMongoClient();
        TableId collectionId = splitContext.getCollectionId();
        int chunkSizeMB = splitContext.getChunkSizeMB();

        BsonDocument keyPattern = new BsonDocument(ID_FIELD, new BsonInt32(1));

        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);
        }

View on GitHub (pinned to cf67b549a7)