{"record":{"id":"cbc1ea06c60709fc","repo":"apache/seatunnel","slug":"could-not-calculate-standalone-splits-fallbac","errorCode":null,"errorMessage":"Could not calculate standalone splits: {}, fallback to SampleSplitter","messagePattern":"Could not calculate standalone splits: (.+?), fallback to SampleSplitter","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-mongodb/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/mongodb/source/splitters/SplitVectorSplitStrategy.java","lineNumber":79,"sourceCode":"\n        BsonDocument splitResult;\n        try {\n            splitResult = splitVector(mongoClient, collectionId, keyPattern, chunkSizeMB);\n        } catch (MongoCommandException e) {\n            if (e.getErrorCode() == UNAUTHORIZED_ERROR) {\n                log.warn(\n                        \"Unauthorized to execute splitVector command: {}, fallback to SampleSplitter\",\n                        e.getErrorMessage());\n            } else {\n                log.warn(\n                        \"Execute splitVector command failed: {}, fallback to SampleSplitter\",\n                        e.getErrorMessage());\n            }\n            return SampleBucketSplitStrategy.INSTANCE.split(splitContext);\n        }\n\n        if (!isCommandSucceed(splitResult)) {\n            log.warn(\n                    \"Could not calculate standalone splits: {}, fallback to SampleSplitter\",\n                    splitResult.getString(\"errmsg\"));\n            return SampleBucketSplitStrategy.INSTANCE.split(splitContext);\n        }\n\n        BsonArray splitKeys = splitResult.getArray(\"splitKeys\");\n        if (CollectionUtils.isEmpty(splitKeys)) {\n            // documents size is less than chunk size, treat the entire collection as single chunk.\n            return SingleSplitStrategy.INSTANCE.split(splitContext);\n        }\n\n        SeaTunnelRowType rowType = shardKeysToRowType(Collections.singleton(ID_FIELD));\n        List<SnapshotSplit> snapshotSplits = new ArrayList<>(splitKeys.size() + 1);\n\n        BsonValue lowerValue = new BsonMinKey();\n        ;\n        for (int i = 0; i < splitKeys.size(); i++) {\n            BsonValue splitKeyValue = splitKeys.get(i).asDocument().get(ID_FIELD);","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-mongodb/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/mongodb/source/splitters/SplitVectorSplitStrategy.java#L61-L97","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the errmsg value in the log for the exact server-side rejection reason.","Correct keyPattern/chunkSizeMB parameters to match the collection's shard key and valid size range.","Test the command manually in mongosh to reproduce the errmsg.","Fall back intentionally by configuring SampleSplitter as the strategy."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// dry-run splitVector and inspect ok/errmsg\nconst r = db.runCommand({splitVector: 'mydb.mycoll', keyPattern: {userId: 1}, maxChunkSizeBytes: 64*1024*1024});\nif (r.ok !== 1) print('splitVector rejected: ' + r.errmsg);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check the logged errmsg for the precise server rejection.","Validate keyPattern/chunkSizeMB against the shard key before running the job.","Keep an explicit sampling fallback configured for splitVector-hostile environments."],"tags":["mongodb","cdc","command-error","fallback"],"backgroundTag":"unexpected-api-response-shape","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}