apache/seatunnel · error · 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 only supports creating offsets from a Map of offset fields (specific(Map)); the filename/position variant inherited from the generic OffsetFactory API is meaningless for PostgreSQL LSN-based offsets and always throws UnsupportedOperationException.
Source
Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-postgres/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/postgres/source/offset/LsnOffsetFactory.java:147
Map<String, String> offsetMap = new HashMap<>();
String lsn = String.valueOf(Lsn.valueOf(committedLsn).asLong());
offsetMap.put(SourceInfo.LSN_KEY, lsn);
offsetMap.put(PostgresOffsetContext.LAST_COMPLETELY_PROCESSED_LSN_KEY, lsn);
offsetMap.put(PostgresOffsetContext.LAST_COMMIT_LSN_KEY, lsn);
offsetMap.put(
SourceInfo.TIMESTAMP_USEC_KEY,
String.valueOf(Conversions.toEpochMicros(Instant.MIN)));
return LsnOffset.of(offsetMap);
}
@Override
public Offset specific(Map<String, String> offset) {
return new LsnOffset(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
- Use `specific(Map<String,String> offset)` with LSN-based offset keys instead.
- Restore state from a checkpoint produced by the same PostgreSQL connector, not from a file-based offset source.
- If you hit this in framework restore code, re-save the checkpoint with the PostgreSQL connector's own offset serialization.
Example fix
// before
Offset o = factory.specific("mysql-bin.000001", 154L);
// after
Map<String,String> offsetMap = new HashMap<>();
offsetMap.put("lsn", "274877906944");
Offset o = factory.specific(offsetMap); Defensive patterns
Strategy: type-guard
Validate before calling
if (offset instanceof Map) { factory.specific((Map<String,String>) offset); } else { throw new IllegalArgumentException("LsnOffset requires map-based offset"); } Type guard
boolean isMapOffset(Object o) { return o instanceof Map<?, ?>; } Try / catch
try {
factory.specific(filename, position);
} catch (UnsupportedOperationException e) {
// fall back to map-based LSN offset
} Prevention
- Never restore PostgreSQL CDC offsets from MySQL-style filename/position state
- Always serialize/restore offsets through the same connector type
- Keep checkpoint state per-connector, not shared across databases
When it happens
Trigger: Calling `offsetFactory.specific(String filename, Long position)` directly, or running a framework code path that restores offsets using filename+position semantics (a MySQL-style checkpoint format) against a PostgreSQL source.
Common situations: Reusing a checkpoint/offset file produced by a MySQL CDC job for a PostgreSQL job; custom code bridging the two connector APIs; framework version mismatch where restore logic assumes 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
- not supported create new Offset by timestamp.
- not supported create new Offset by committed offset.
- not supported create new Offset by filename and position.
- not supported create new Offset by timestamp.
- UNSUPPORTED_OPERATION
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/d8054b2920589a23.
Report an issue: GitHub.