{"record":{"id":"4b69d4b97a3ed986","repo":"apache/seatunnel","slug":"unsupported-operation-4b69d4","errorCode":"UNSUPPORTED_OPERATION","errorMessage":"not supported create new Offset by filename and position.","messagePattern":"not supported create new Offset by filename and position\\.","errorType":"error_code","errorClass":"MongodbConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-mongodb/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/mongodb/source/offset/ChangeStreamOffsetFactory.java","lineNumber":54,"sourceCode":"\n    @Override\n    public Offset neverStop() {\n        return ChangeStreamOffset.NO_STOPPING_OFFSET;\n    }\n\n    @Override\n    public Offset latest() {\n        return new ChangeStreamOffset(currentBsonTimestamp());\n    }\n\n    @Override\n    public Offset specific(Map<String, String> offset) {\n        return new ChangeStreamOffset(offset);\n    }\n\n    @Override\n    public Offset specific(String filename, Long position) {\n        throw new MongodbConnectorException(\n                UNSUPPORTED_OPERATION, \"not supported create new Offset by filename and position.\");\n    }\n\n    @Override\n    public Offset timestamp(long timestamp) {\n        return new ChangeStreamOffset(bsonTimestampFromEpochMillis(timestamp));\n    }\n}\n","sourceCodeStart":36,"sourceCodeEnd":63,"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/offset/ChangeStreamOffsetFactory.java#L36-L63","documentation":"ChangeStreamOffsetFactory implements the SourceConnector's Offset SPI. MongoDB change streams are only resumable via a resume token (BSON document), not via the classic (filename, position) log-offset model used by other CDC connectors, so this factory deliberately refuses to build an offset from filename+position and throws UNSUPPORTED_OPERATION.","triggerScenarios":"Calling OffsetFactory.specific(String filename, Long position) on the MongoDB CDC connector — typically from framework code that restores offsets from a checkpoint or a config that supplies binlog-file/binlog-pos style offsets instead of a change-stream resume token.","commonSituations":"Migrating a job config from MySQL/PostgreSQL CDC (which use file+position offsets) to MongoDB CDC; restoring a SeaTunnel checkpoint saved by a different connector; framework code path that assumes all CDC sources support filename/position offsets.","solutions":["Supply the offset as a resume-token map via specific(Map<String,String>) (e.g. {_data: '<resume token>'}) instead of filename/position","Use OffsetFactory.timestamp(long) to start from a wall-clock timestamp if you don't have a resume token","Remove any binlog-file/binlog-pos style offset keys from the MongoDB CDC source config","Update caller/restore logic to branch on connector type and use the MongoDB-specific offset API"],"exampleFix":"// before\nOffset offset = offsetFactory.specific(\"mongod.log\", 1024L);\n// after\nOffset offset = offsetFactory.specific(Collections.singletonMap(\"_data\", \"8264F1...\"));\n// or from a time point:\nOffset offset = offsetFactory.timestamp(System.currentTimeMillis() - 3600_000);","handlingStrategy":"validation","validationCode":"if (offsetMap.containsKey(\"filename\") || offsetMap.containsKey(\"position\")) {\n    throw new IllegalArgumentException(\"MongoDB CDC offsets must use a resume token (_data), not filename/position\");\n}","typeGuard":"boolean supportsFilePositionOffset(OffsetFactory f) { return !(f instanceof ChangeStreamOffsetFactory); }","tryCatchPattern":"try {\n    offset = factory.specific(filename, position);\n} catch (MongodbConnectorException e) {\n    if (\"UNSUPPORTED_OPERATION\".equals(e.getSeaTunnelErrorCode().getCode())) {\n        offset = factory.specific(Map.of(\"_data\", resumeToken));\n    } else throw e;\n}","preventionTips":["Never reuse MySQL/PostgreSQL CDC offset configs for MongoDB CDC","Use the Map-based specific() or timestamp() API for MongoDB offsets","Keep resume tokens intact in checkpoints; do not decompose them into file/position pairs"],"tags":["mongodb","cdc","offset","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}