apache/seatunnel · error · MongodbConnectorException

UNSUPPORTED_OPERATION

UNSUPPORTED_OPERATION

Error message

not supported create new Offset by filename and position.

What it means

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.

Source

Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-mongodb/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/mongodb/source/offset/ChangeStreamOffsetFactory.java:54

    @Override
    public Offset neverStop() {
        return ChangeStreamOffset.NO_STOPPING_OFFSET;
    }

    @Override
    public Offset latest() {
        return new ChangeStreamOffset(currentBsonTimestamp());
    }

    @Override
    public Offset specific(Map<String, String> offset) {
        return new ChangeStreamOffset(offset);
    }

    @Override
    public Offset specific(String filename, Long position) {
        throw new MongodbConnectorException(
                UNSUPPORTED_OPERATION, "not supported create new Offset by filename and position.");
    }

    @Override
    public Offset timestamp(long timestamp) {
        return new ChangeStreamOffset(bsonTimestampFromEpochMillis(timestamp));
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Supply the offset as a resume-token map via specific(Map<String,String>) (e.g. {_data: '<resume token>'}) instead of filename/position
  2. Use OffsetFactory.timestamp(long) to start from a wall-clock timestamp if you don't have a resume token
  3. Remove any binlog-file/binlog-pos style offset keys from the MongoDB CDC source config
  4. Update caller/restore logic to branch on connector type and use the MongoDB-specific offset API

Example fix

// before
Offset offset = offsetFactory.specific("mongod.log", 1024L);
// after
Offset offset = offsetFactory.specific(Collections.singletonMap("_data", "8264F1..."));
// or from a time point:
Offset offset = offsetFactory.timestamp(System.currentTimeMillis() - 3600_000);
Defensive patterns

Strategy: validation

Validate before calling

if (offsetMap.containsKey("filename") || offsetMap.containsKey("position")) {
    throw new IllegalArgumentException("MongoDB CDC offsets must use a resume token (_data), not filename/position");
}

Type guard

boolean supportsFilePositionOffset(OffsetFactory f) { return !(f instanceof ChangeStreamOffsetFactory); }

Try / catch

try {
    offset = factory.specific(filename, position);
} catch (MongodbConnectorException e) {
    if ("UNSUPPORTED_OPERATION".equals(e.getSeaTunnelErrorCode().getCode())) {
        offset = factory.specific(Map.of("_data", resumeToken));
    } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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