{"record":{"id":"d8054b2920589a23","repo":"apache/seatunnel","slug":"not-supported-create-new-offset-by-filename-and-po-d8054b","errorCode":null,"errorMessage":"not supported create new Offset by filename and position.","messagePattern":"not supported create new Offset by filename and position\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-postgres/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/postgres/source/offset/LsnOffsetFactory.java","lineNumber":147,"sourceCode":"        Map<String, String> offsetMap = new HashMap<>();\n        String lsn = String.valueOf(Lsn.valueOf(committedLsn).asLong());\n        offsetMap.put(SourceInfo.LSN_KEY, lsn);\n        offsetMap.put(PostgresOffsetContext.LAST_COMPLETELY_PROCESSED_LSN_KEY, lsn);\n        offsetMap.put(PostgresOffsetContext.LAST_COMMIT_LSN_KEY, lsn);\n        offsetMap.put(\n                SourceInfo.TIMESTAMP_USEC_KEY,\n                String.valueOf(Conversions.toEpochMicros(Instant.MIN)));\n        return LsnOffset.of(offsetMap);\n    }\n\n    @Override\n    public Offset specific(Map<String, String> offset) {\n        return new LsnOffset(offset);\n    }\n\n    @Override\n    public Offset specific(String filename, Long position) {\n        throw new UnsupportedOperationException(\n                \"not supported create new Offset by filename and position.\");\n    }\n\n    @Override\n    public Offset timestamp(long timestamp) {\n        throw new UnsupportedOperationException(\"not supported create new Offset by timestamp.\");\n    }\n}\n","sourceCodeStart":129,"sourceCodeEnd":156,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-postgres/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/postgres/source/offset/LsnOffsetFactory.java#L129-L156","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nOffset o = factory.specific(\"mysql-bin.000001\", 154L);\n// after\nMap<String,String> offsetMap = new HashMap<>();\noffsetMap.put(\"lsn\", \"274877906944\");\nOffset o = factory.specific(offsetMap);","handlingStrategy":"type-guard","validationCode":"if (offset instanceof Map) { factory.specific((Map<String,String>) offset); } else { throw new IllegalArgumentException(\"LsnOffset requires map-based offset\"); }","typeGuard":"boolean isMapOffset(Object o) { return o instanceof Map<?, ?>; }","tryCatchPattern":"try {\n    factory.specific(filename, position);\n} catch (UnsupportedOperationException e) {\n    // fall back to map-based LSN offset\n}","preventionTips":["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"],"tags":["postgresql","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-14T05:17:10.506Z"}