{"record":{"id":"cf783ad01ed79b4e","repo":"dbeaver/dbeaver","slug":"can-t-insert-row","errorCode":null,"errorMessage":"Can't insert row","messagePattern":"Can't insert row","errorType":"exception","errorClass":"DBCException","httpStatus":null,"severity":"error","filePath":"plugins/org.jkiss.dbeaver.data.transfer/src/org/jkiss/dbeaver/tools/transfer/database/DatabaseTransferConsumer.java","lineNumber":484,"sourceCode":"                        log.error(\"Error inserting row\", e);\n                        if (ignoreErrors) {\n                            break;\n                        }\n                        if (DBWorkbench.getPlatform().getApplication().isHeadlessMode()) {\n                            if (e instanceof DBCException dbe) {\n                                throw dbe;\n                            }\n                            throw new DBCException(e.getMessage(), e);\n                        }\n                        String message;\n                        if (disableUsingBatches) {\n                            message = DTMessages.database_transfer_consumer_task_error_occurred_during_data_load;\n                        } else {\n                            message = DTMessages.database_transfer_consumer_task_error_occurred_during_batch_insert;\n                        }\n                        DBPPlatformUI.UserResponse response = DBWorkbench.getPlatformUI().showErrorStopRetryIgnore(message, e, true);\n                        retryInsert = switch (response) {\n                            case STOP -> throw new DBCException(\"Can't insert row\", e);\n                            case RETRY -> true;\n                            case IGNORE -> false;\n                            case IGNORE_ALL -> {\n                                ignoreErrors = true;\n                                yield false;\n                            }\n                            default -> retryInsert;\n                        };\n                    }\n                } while (retryInsert);\n            }\n        }\n        if (settings.isUseTransactions() && needCommit && !targetSession.getProgressMonitor().isCanceled()) {\n            DBCTransactionManager txnManager = DBUtils.getTransactionManager(targetSession.getExecutionContext());\n            if (txnManager != null && txnManager.isSupportsTransactions() && !txnManager.isAutoCommit()) {\n                targetSession.getProgressMonitor().subTask(\"Commit changes\");\n                txnManager.commit(targetSession);\n            }","sourceCodeStart":466,"sourceCodeEnd":502,"githubUrl":"https://github.com/dbeaver/dbeaver/blob/1e5ee1042bc61661368942aece126f3e67049955/plugins/org.jkiss.dbeaver.data.transfer/src/org/jkiss/dbeaver/tools/transfer/database/DatabaseTransferConsumer.java#L466-L502","documentation":"Thrown when a row or batch INSERT fails during data transfer and the user picks 'Stop' in the interactive Stop/Retry/Ignore/Ignore-All dialog. The original insert exception is wrapped as the cause. This branch is only reachable in UI mode; in headless mode the underlying exception is thrown directly before the dialog is shown.","triggerScenarios":"executeBatch.execute(targetSession, options) throws a Throwable (usually a SQLException wrapped in DBCException) during fetchRow/batch flush; ignoreErrors is false; the platform is NOT in headless mode; DBWorkbench.getPlatformUI().showErrorStopRetryIgnore(...) returns UserResponse.STOP.","commonSituations":"Source-to-target column type mismatch; NOT NULL/CHECK/FK constraint violation on the target; value too long for the target column; target table locked by another transaction; malformed batch data.","solutions":["Inspect the wrapped cause (SQLException) for the DB-specific error code to find the offending column or constraint","Enable 'Ignore errors' in the transfer settings to skip problematic rows instead of stopping","Turn off batch inserts so each row is reported individually, exposing the exact failing row","Validate source-to-target column type mappings in the wizard before starting the transfer"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    consumer.fetchTargetObjects(monitor, source, columns);\n} catch (DBCException e) {\n    if (\"Can't insert row\".equals(e.getMessage())) {\n        // user chose Stop; inspect e.getCause() for the SQLException\n        log.warn(\"Transfer stopped by user on insert error\", e.getCause());\n    } else {\n        throw e;\n    }\n}","preventionTips":["Pre-validate column type compatibility between source and target before starting the transfer","Enable 'Ignore errors' for bulk loads where partial success is acceptable","Disable batch mode during initial test runs to get per-row error detail"],"tags":["data-transfer","insert","batch","user-cancel","consumer"],"backgroundTag":null,"analyzedSha":"1e5ee1042bc61661368942aece126f3e67049955","analyzedAt":"2026-08-13T23:31:13.467Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}