apache/seatunnel · error · MongodbConnectorException

COMMON_ERROR_CODE.UNSUPPORTED_OPERATION

COMMON_ERROR_CODE.UNSUPPORTED_OPERATION

Error message

Unsupported handleSplitRequest: %d

What it means

MongodbSplitEnumerator.handleSplitRequest always throws UNSUPPORTED_OPERATION. In SeaTunnel's split-assignment protocol the enumerator pushes splits to readers proactively; readers must never request splits, so any incoming split request indicates a protocol violation.

Solutions

  1. Remove any reader-side call to handleSplitRequest; readers should receive splits via addSplitBack/assigned splits callbacks.
  2. Use the stock MongoDBSourceReader instead of a custom one, or follow the SourceReader contract where splits are pushed by the enumerator.
  3. Check SourceReaderContext/reader registration so the enumerator's assignment logic runs (registerReader + assignment on start).

Example fix

// before (in reader)
enumerator.handleSplitRequest(subtaskId);
// after (rely on pushed splits)
// implement handleAddSplits(list) on the reader; never request splits
Defensive patterns

Strategy: type-guard

Validate before calling

// Reader side: never call enumerator.handleSplitRequest; assert protocol usage in tests:
// assertDoesNotThrow(() -> reader reads only via onSplitAssigned callbacks)

Type guard

static boolean enumeratorSupportsSplitRequest(SplitEnumerator<?, ?> e) {
    return !(e instanceof MongodbSplitEnumerator); // it does not support pull-style requests
}

Try / catch

try {
    enumerator.handleSplitRequest(id);
} catch (MongodbConnectorException e) {
    // UNSUPPORTED_OPERATION: switch to pushed-assignment reader design
}

Prevention

When it happens

Trigger: A SourceReader (or custom/translated reader) calls handleSplitRequest(subtaskId) on the MongoDB enumerator — e.g. a custom reader implementation that pulls splits instead of registering a SplitEnumeratorContext-driven assignment.

Common situations: Custom source reader code or a translation-layer mismatch where the reader actively requests splits; misuse of the SourceReader API in an extension built on the MongoDB connector.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at seatunnel-connectors-v2/connector-mongodb/src/main/java/org/apache/seatunnel/connectors/seatunnel/mongodb/source/enumerator/MongodbSplitEnumerator.java:113

            clientProvider.close();
        }
    }

    @Override
    public void addSplitsBack(List<MongoSplit> splits, int subtaskId) {
        if (splits != null) {
            log.info("Received {} split(s) back from subtask {}.", splits.size(), subtaskId);
            pendingSplits.addAll(splits);
        }
    }

    @Override
    public int currentUnassignedSplitSize() {
        return pendingSplits.size();
    }

    @Override
    public void handleSplitRequest(int subtaskId) {
        throw new MongodbConnectorException(
                CommonErrorCodeDeprecated.UNSUPPORTED_OPERATION,
                String.format("Unsupported handleSplitRequest: %d", subtaskId));
    }

    @Override
    public void registerReader(int subtaskId) {
        log.debug("Register reader {} to MongodbSplitEnumerator.", subtaskId);
        if (!pendingSplits.isEmpty()) {
            assignSplits(Collections.singletonList(subtaskId));
        }
    }

    @Override
    public ArrayList<MongoSplit> snapshotState(long checkpointId) {
        synchronized (stateLock) {
            return pendingSplits;
        }

View on GitHub (pinned to cf67b549a7)