dbeaver/dbeaver · error · DBCException

Can't insert row

Error message

Can't insert row

What it means

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.

Source

Thrown at plugins/org.jkiss.dbeaver.data.transfer/src/org/jkiss/dbeaver/tools/transfer/database/DatabaseTransferConsumer.java:484

                        log.error("Error inserting row", e);
                        if (ignoreErrors) {
                            break;
                        }
                        if (DBWorkbench.getPlatform().getApplication().isHeadlessMode()) {
                            if (e instanceof DBCException dbe) {
                                throw dbe;
                            }
                            throw new DBCException(e.getMessage(), e);
                        }
                        String message;
                        if (disableUsingBatches) {
                            message = DTMessages.database_transfer_consumer_task_error_occurred_during_data_load;
                        } else {
                            message = DTMessages.database_transfer_consumer_task_error_occurred_during_batch_insert;
                        }
                        DBPPlatformUI.UserResponse response = DBWorkbench.getPlatformUI().showErrorStopRetryIgnore(message, e, true);
                        retryInsert = switch (response) {
                            case STOP -> throw new DBCException("Can't insert row", e);
                            case RETRY -> true;
                            case IGNORE -> false;
                            case IGNORE_ALL -> {
                                ignoreErrors = true;
                                yield false;
                            }
                            default -> retryInsert;
                        };
                    }
                } while (retryInsert);
            }
        }
        if (settings.isUseTransactions() && needCommit && !targetSession.getProgressMonitor().isCanceled()) {
            DBCTransactionManager txnManager = DBUtils.getTransactionManager(targetSession.getExecutionContext());
            if (txnManager != null && txnManager.isSupportsTransactions() && !txnManager.isAutoCommit()) {
                targetSession.getProgressMonitor().subTask("Commit changes");
                txnManager.commit(targetSession);
            }

View on GitHub (pinned to 1e5ee1042b)

Solutions

  1. Inspect the wrapped cause (SQLException) for the DB-specific error code to find the offending column or constraint
  2. Enable 'Ignore errors' in the transfer settings to skip problematic rows instead of stopping
  3. Turn off batch inserts so each row is reported individually, exposing the exact failing row
  4. Validate source-to-target column type mappings in the wizard before starting the transfer
Defensive patterns

Strategy: try-catch

Try / catch

try {
    consumer.fetchTargetObjects(monitor, source, columns);
} catch (DBCException e) {
    if ("Can't insert row".equals(e.getMessage())) {
        // user chose Stop; inspect e.getCause() for the SQLException
        log.warn("Transfer stopped by user on insert error", e.getCause());
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of dbeaver/dbeaver@1e5ee1042b (2026-08-13). Data as JSON: /api/errors/cf783ad01ed79b4e. Report an issue: GitHub.