apache/seatunnel · error · SeaTunnelRuntimeException

COMMON-11

COMMON-11

Error message

Failed to initialize error sink writer

What it means

SeaTunnelRuntimeException with code CommonErrorCodeDeprecated.WRITER_OPERATION_FAILED thrown by ensureInitialized when opening/initializing the ROUTE error sink writer (creating the sink writer from the error-sink configuration) fails. Any exception raised during sink writer creation is wrapped as the cause, and the error sink classloader is released before propagating.

Source

Thrown at seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/task/error/DefaultErrorSinkWriter.java:437

            if (e instanceof Error) {
                throw (Error) e;
            }
            log.error(
                    "Failed to initialize error sink writer for pluginName={}, errorTable={}, optionKeys={}",
                    sinkConfig.getPluginName(),
                    sinkConfig.getErrorTable(),
                    optionKeys(sinkConfig.getOptions()),
                    e);
            try {
                closeWriterIfPossible();
            } catch (Throwable closeEx) {
                if (closeEx instanceof Error) {
                    throw (Error) closeEx;
                }
                e.addSuppressed(closeEx);
            }
            releaseErrorSinkClassLoaderIfNeeded();
            throw new SeaTunnelRuntimeException(
                    CommonErrorCodeDeprecated.WRITER_OPERATION_FAILED,
                    "Failed to initialize error sink writer",
                    e);
        }
    }

    private MetricsContext metricsContextOrNoop() {
        return metricsContext == null ? new NoopMetricsContext() : metricsContext;
    }

    private EventListener eventListenerOrNoop() {
        return eventListener == null ? event -> {} : eventListener;
    }

    static void validateSupportedErrorSinkLifecycle(
            String pluginName, SeaTunnelSink<SeaTunnelRow, ?, ?, ?> sink) throws Exception {
        List<String> unsupportedFeatures = new ArrayList<>();
        if (sink.getWriterStateSerializer().isPresent()) {

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Read the wrapped cause for the real initialization failure
  2. Verify the error sink plugin is installed (install-plugin.sh) and the pluginName is correct
  3. Validate error-sink config options against the sink's documented options
  4. Remove transactional/exactly-once options from the error sink (see ROUTE lifecycle restrictions)
  5. Check network/credentials needed by the error sink

Example fix

# before
error-sink {
  plugin_name = "Jdbc"
  url = "jdbc:mysql://wrong-host:3306/db"
}
# after
error-sink {
  plugin_name = "Console"
}
Defensive patterns

Strategy: fallback

Validate before calling

// pre-validate error sink config before job start
Options.checkErrorSinkConfig(sinkConfig); // verify pluginName installed and options valid

Try / catch

try {
    errorSinkWriter.open();
} catch (SeaTunnelRuntimeException e) {
    if (CommonErrorCodeDeprecated.WRITER_OPERATION_FAILED.equals(e.getSeaTunnelErrorCode())) {
        LOG.error("Error sink init failed: ", e.getCause());
        // fall back to Console error sink or fail job
    }
    throw e;
}

Prevention

When it happens

Trigger: open() or writeAndCheckAccepted() call ensureInitialized(); the underlying error sink's SinkWriter creation throws (bad plugin, missing plugin jar, invalid sink config, connection failure during sink init).

Common situations: Error-sink plugin name typo or plugin not installed; error sink needs credentials/connection that are wrong; incompatible error-sink options (e.g. transactional options on an unsupported sink); classloader/JAR conflicts.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/591b57b82f72e9df. Report an issue: GitHub.