{"record":{"id":"1049da40a08b68c3","repo":"apache/seatunnel","slug":"snapshotting-of-table-table-id-failed-1049da","errorCode":null,"errorMessage":"Snapshotting of table ${table.id()} failed","messagePattern":"Snapshotting of table (.+?) failed","errorType":"exception","errorClass":"ConnectException","httpStatus":null,"severity":"critical","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-sqlserver/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/sqlserver/source/reader/fetch/scan/SqlServerSnapshotSplitReadTask.java","lineNumber":238,"sourceCode":"                            snapshotSplit.splitId(),\n                            Strings.duration(stop - exportStart));\n                    snapshotProgressListener.rowsScanned(\n                            snapshotContext.partition, table.id(), rows);\n                    logTimer = getTableScanLogTimer();\n                }\n                dispatcher.dispatchSnapshotEvent(\n                        snapshotContext.partition,\n                        table.id(),\n                        getChangeRecordEmitter(snapshotContext, table.id(), row),\n                        snapshotReceiver);\n            }\n            log.info(\n                    \"Finished exporting {} records for split '{}', total duration '{}'\",\n                    rows,\n                    snapshotSplit.splitId(),\n                    Strings.duration(clock.currentTimeInMillis() - exportStart));\n        } catch (SQLException e) {\n            throw new ConnectException(\"Snapshotting of table \" + table.id() + \" failed\", e);\n        }\n    }\n\n    protected ChangeRecordEmitter getChangeRecordEmitter(\n            SqlSeverSnapshotContext snapshotContext, TableId tableId, Object[] row) {\n        snapshotContext.offset.event(tableId, clock.currentTime());\n        return new SnapshotChangeRecordEmitter(\n                snapshotContext.partition, snapshotContext.offset, row, clock);\n    }\n\n    private Threads.Timer getTableScanLogTimer() {\n        return Threads.timer(clock, LOG_INTERVAL);\n    }\n\n    private Object readField(ResultSet rs, int columnIndex) throws SQLException {\n        final ResultSetMetaData metaData = rs.getMetaData();\n        final int columnType = metaData.getColumnType(columnIndex);\n","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-sqlserver/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/sqlserver/source/reader/fetch/scan/SqlServerSnapshotSplitReadTask.java#L220-L256","documentation":"Thrown by SqlServerSnapshotSplitReadTask.createDataEventsForTable when the JDBC query that exports a snapshot split's rows throws SQLException. The task wraps it in a ConnectException naming the table, failing the snapshot phase for that split.","triggerScenarios":"SQLException while executing the SELECT over the split's key range against table table.id() during createDataEvents → createDataEventsForTable — invalid table name, dropped table mid-snapshot, permissions, or connection failure.","commonSituations":"Table renamed/dropped between split enumeration and snapshot read; user lacks SELECT permission; database became unavailable; case-sensitive or bracket-quoted identifier mismatches in SQL Server.","solutions":["Verify the table still exists and the configured table list matches exactly (database.schema.table)","Check the SQL Server login has SELECT permission on the table","Check the SQLException cause in the stack trace for connection issues and fix network/timeout settings","Re-run the job; if a table changes mid-snapshot, exclude it or use a consistent snapshot point"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Validate table exists and is selectable before running the job\nSELECT 1 FROM sys.tables t\nJOIN sys.schemas s ON t.schema_id = s.schema_id\nWHERE s.name + '.' + t.name = 'dbo.Orders';\n-- and grant: GRANT SELECT ON dbo.Orders TO seatunnel_user;","typeGuard":null,"tryCatchPattern":"// Operator-level: catch job failure and check the cause chain\ntry {\n    submitJob(cfg);\n} catch (Exception e) {\n    if (getCause(e, SQLException.class) != null) {\n        log.error(\"Snapshot SQL failed for table; check existence/permissions\", e);\n    }\n    throw e;\n}","preventionTips":["Freeze DDL (drop/rename) on captured tables during snapshot","Grant the connector login SELECT on all captured tables","Use exact fully-qualified table names in table-names","Check the nested SQLException for the true root cause"],"tags":["cdc","sqlserver","snapshot","jdbc","sql"],"backgroundTag":"sql-query-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}