apache/seatunnel · error · IllegalArgumentException
Elasticsearch multi-table writer requires…
Error message
Elasticsearch multi-table writer requires ElasticsearchMultiTableResourceManager
What it means
ElasticsearchSinkWriter.setMultiTableResourceManager validates that the provided MultiTableResourceManager is an ElasticsearchMultiTableResourceManager. Any other implementation cannot supply the ES clients the writer needs, so it throws IllegalArgumentException before adopting the resource.
Solutions
- Ensure the engine creates ElasticsearchMultiTableResourceManager for ES multi-table sinks
- Align connector and engine versions so the resource manager types match
- In tests, pass an actual ElasticsearchMultiTableResourceManager (with real or mocked EsRestClient) instead of a generic stub
Example fix
// before MultiTableResourceManager<EsRestClient> rm = new GenericResourceManager<>(client); writer.setMultiTableResourceManager(rm, 0); // after ElasticsearchMultiTableResourceManager rm = new ElasticsearchMultiTableResourceManager(clients); writer.setMultiTableResourceManager(rm, 0);
Defensive patterns
Strategy: type-guard
Type guard
if (!(rm instanceof ElasticsearchMultiTableResourceManager)) {
throw new IllegalArgumentException("Expected ElasticsearchMultiTableResourceManager, got " + rm.getClass());
} Prevention
- Use the connector's own ElasticsearchMultiTableResourceManager in tests and custom wiring
- Keep engine and connector versions in sync
- Assert resource-manager type in unit tests before invoking the writer
When it happens
Trigger: The engine/framework passes a MultiTableResourceManager<EsRestClient> that is not the Elasticsearch-specific implementation into setMultiTableResourceManager, typically in multi-table sink setups or tests exercising resource-manager wiring.
Common situations: Custom/engine changes supplying a generic resource manager; mismatched connector/engine versions where the ES resource manager class differs; unit tests passing stub implementations.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- All candidate sink tables were skipped in Flink starter.
- All candidate sink tables were skipped in Flink starter.
- All candidate sink tables were skipped in Spark starter.
- All candidate sink tables were skipped in Spark starter.
- HANDLE_SAVE_MODE_FAILED
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/dc06bf38005c75e8.
Report an issue: GitHub.
Appendix: source
Thrown at seatunnel-connectors-v2/connector-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/sink/ElasticsearchSinkWriter.java:144
// MultiTableSinkWriter injects one shared client after constructing all table writers.
// Standalone writers keep the existing fail-fast connection initialization behavior.
if (!(context instanceof SinkContextProxy)) {
initializeStandaloneClient();
}
context.registerFlushAction(this::timerFlush);
}
@Override
public MultiTableResourceManager<EsRestClient> initMultiTableResourceManager(
int tableSize, int queueSize) {
return new ElasticsearchMultiTableResourceManager();
}
@Override
public void setMultiTableResourceManager(
MultiTableResourceManager<EsRestClient> multiTableResourceManager, int queueIndex) {
if (!(multiTableResourceManager instanceof ElasticsearchMultiTableResourceManager)) {
throw new IllegalArgumentException(
"Elasticsearch multi-table writer requires ElasticsearchMultiTableResourceManager");
}
releaseSharedClientResource();
closeOwnedClient();
ElasticsearchMultiTableResourceManager resourceManager =
(ElasticsearchMultiTableResourceManager) multiTableResourceManager;
try {
ElasticsearchMultiTableResourceManager.ClientResource clientResource =
resourceManager.getOrCreateClientResource(config);
this.esRestClient = clientResource.getEsRestClient();
this.clusterInfo = clientResource.getClusterInfo();
this.multiTableResourceManager = resourceManager;
this.multiTableClientResource = clientResource;
this.ownsEsRestClient = false;
initializeSerializer(initialRowType);
} catch (RuntimeException | Error e) {
// A failed injection aborts MultiTableSinkWriter construction, whose close lifecycle
// will not run. Close every cached connection group before propagating the failure.View on GitHub (pinned to cf67b549a7)