{"record":{"id":"d86e0432e826fb6c","repo":"apache/seatunnel","slug":"post-sync-operation-failed-table-context-not-foun","errorCode":null,"errorMessage":"Post-sync operation failed: table context not found, tableId={}, splitId={}","messagePattern":"Post-sync operation failed: table context not found, tableId=(.+?), splitId=(.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/split/ContinuousMultipleTableFileSourceSplitEnumerator.java","lineNumber":700,"sourceCode":"                    remainingByCheckpoint.entrySet()) {\n                pendingOpsByCheckpoint.put(entry.getKey(), entry.getValue());\n            }\n        }\n\n        log.info(\n                \"Post-sync commit finished for checkpoint {}: attempted={}, success={}, stale_skipped={}, failed={}, remaining_checkpoints={}\",\n                checkpointId,\n                attempted,\n                succeeded,\n                staleSkipped,\n                failed,\n                remainingByCheckpoint.size());\n    }\n\n    private OpCommitResult commitSingleOperation(FileSourceOperationState op, long checkpointId) {\n        Optional<TableScanContext> tableContextOpt = findTableScanContext(op.getTableId());\n        if (!tableContextOpt.isPresent()) {\n            log.warn(\n                    \"Post-sync operation failed: table context not found, tableId={}, splitId={}\",\n                    op.getTableId(),\n                    op.getSplitId());\n            return OpCommitResult.FAILED_RETRYABLE;\n        }\n\n        try {\n            if (op.getAction() == FilePostSyncAction.DELETE) {\n                return commitDeleteOperation(tableContextOpt.get(), op, checkpointId);\n            }\n            if (op.getAction() == FilePostSyncAction.BACKUP) {\n                return commitBackupOperation(tableContextOpt.get(), op, checkpointId);\n            }\n            return OpCommitResult.SUCCESS;\n        } catch (Exception e) {\n            log.warn(\n                    \"Post-sync operation failed and will be retried: action={}, splitId={}, source={}, retryCount={}\",\n                    op.getAction(),","sourceCodeStart":682,"sourceCodeEnd":718,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/split/ContinuousMultipleTableFileSourceSplitEnumerator.java#L682-L718","documentation":"commitSingleOperation looks up the TableScanContext for a pending post-sync operation by its tableId. If the context cannot be found, it logs this warning and returns OpCommitResult.FAILED_RETRYABLE, so the post-sync operation (backup/delete/etc.) is not executed and will be retried later. The operation cannot proceed without the table's scan context (source FS, trash path, etc.).","triggerScenarios":"A file post-sync operation state references a tableId absent from the enumerator's registered table contexts — e.g. table reconfiguration mid-job, state restored from a mismatched checkpoint, or contexts cleared before commit.","commonSituations":"Job restart from a checkpoint created under a different table configuration; table removed from config while its queued post-sync ops still exist; restore across config edits.","solutions":["Ensure the job config tables match those referenced by the checkpoint/savepoint being restored from","Restart with a fresh checkpoint if table definitions changed intentionally","Verify addTableScanContext registration happens for every table that produces post-sync operations"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Before persisting post-sync op state, ensure its tableId is registered\nif (!findTableScanContext(op.getTableId()).isPresent()) {\n    throw new IllegalStateException(\n            \"Cannot queue post-sync op for unregistered tableId=\" + op.getTableId());\n}","typeGuard":null,"tryCatchPattern":"Optional<TableScanContext> ctx = findTableScanContext(op.getTableId());\nif (!ctx.isPresent()) {\n    log.warn(\"Post-sync operation failed: table context not found, tableId={}, splitId={}\",\n            op.getTableId(), op.getSplitId());\n    return OpCommitResult.FAILED_RETRYABLE;\n}","preventionTips":["Keep table configuration stable across checkpoint/restore","Never remove a table from config while its post-sync operations are still queued","Restore checkpoints only with a job config whose table set matches"],"tags":["file-connector","post-sync","table-context","checkpoint"],"backgroundTag":"record-not-found","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}