apache/seatunnel · error · java.lang.UnsupportedOperationException

not supported create new Offset by filename and position.

Error message

not supported create new Offset by filename and position.

What it means

LsnOffsetFactory.specific(String filename, Long position) is an explicitly unsupported operation for Db2: unlike MySQL binlog offsets, Db2 offsets are LSN-based and cannot be constructed from a (filename, position) pair. Calling it always throws UnsupportedOperationException with this message. The same applies to the timestamp-based variant.

Source

Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-db2/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/db2/source/offset/LsnOffsetFactory.java:69

    }

    @Override
    public Offset latest() {
        try (JdbcConnection jdbcConnection = dialect.openJdbcConnection(sourceConfig)) {
            return Db2Utils.currentLsn((Db2Connection) jdbcConnection);
        } catch (Exception e) {
            throw new RuntimeException("Read the binlog offset error", e);
        }
    }

    @Override
    public Offset specific(Map<String, String> offset) {
        return LsnOffset.valueOf(offset);
    }

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

    @Override
    public Offset timestamp(long timestamp) {
        throw new UnsupportedOperationException("not supported create new Offset by timestamp.");
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Do not restore Db2 offsets from filename/position; use LsnOffsetFactory.specific(Map<String, String>) with LSN-based offset keys instead.
  2. Obtain the offset via latest() and start streaming from the current LSN, or use a previously saved Db2 LSN offset from the connector's own checkpoint.
  3. If migrating from another database's checkpoint, discard the old offsets and take a fresh snapshot with the Db2 source.
  4. Avoid generic code paths that assume file/position offsets; branch on the dialect before constructing offsets.

Example fix

// before
Offset offset = offsetFactory.specific("log.bin", 123L); // throws
// after
Offset offset = offsetFactory.specific(Map.of("lsn", "0000:0001:0002"));
// or start from current position:
Offset offset = offsetFactory.latest();
Defensive patterns

Strategy: type-guard

Validate before calling

// Only call specific(filename, position) for binlog-based dialects
if (offsetFactory instanceof LsnOffsetFactory) {
    offset = offsetFactory.specific(offsetMap); // LSN map
} else {
    offset = offsetFactory.specific(filename, position);
}

Type guard

boolean supportsFilePositionOffsets(OffsetFactory f) {
    return !(f instanceof LsnOffsetFactory);
}

Try / catch

try {
    offset = offsetFactory.specific(filename, position);
} catch (UnsupportedOperationException e) {
    offset = offsetFactory.latest(); // fall back to current LSN for LSN-based dialects
}

Prevention

When it happens

Trigger: Any code path that requests an offset from a specific filename and position — e.g. restoring a checkpoint that was captured with MySQL-style filename/position semantics, or caller code that assumes the generic OffsetFactory API supports file/position offsets for all databases.

Common situations: Migrating a job or restoring a checkpoint/savepoint produced by a different CDC connector (e.g. MySQL) into the Db2 source; generic framework code calling specific(filename, position) uniformly across dialects; hand-written code building an offset from a binlog-file style spec.

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/9912b4417ec014a9. Report an issue: GitHub.