apache/seatunnel · error · IllegalArgumentException

The %s mode is not supported.

Error message

The %s mode is not supported.

What it means

StopConfig.getStopOffset mirrors the startup logic: it maps the configured stop mode (NEVER, LATEST, SPECIFIC, TIMESTAMP) to an offset, and the default branch throws IllegalArgumentException('The %s mode is not supported.') for any other StopMode value.

Source

Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-base/src/main/java/org/apache/seatunnel/connectors/cdc/base/config/StopConfig.java:51

    private static final long serialVersionUID = 1L;

    @Getter private final StopMode stopMode;
    private final String specificOffsetFile;
    private final Long specificOffsetPos;
    private final Long timestamp;

    public Offset getStopOffset(OffsetFactory offsetFactory) {
        switch (stopMode) {
            case LATEST:
                return offsetFactory.latest();
            case NEVER:
                return offsetFactory.neverStop();
            case SPECIFIC:
                return offsetFactory.specific(specificOffsetFile, specificOffsetPos);
            case TIMESTAMP:
                return offsetFactory.timestamp(timestamp);
            default:
                throw new IllegalArgumentException(
                        String.format("The %s mode is not supported.", stopMode));
        }
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Set stop.mode to a supported value: never, latest, specific, or timestamp
  2. Keep connector-cdc-base and CDC connector versions consistent
  3. Add the missing case to the switch if you maintain a fork
  4. Verify the config parser maps your stop.mode string to the intended enum

Example fix

// before
stop { mode = "never-stop" }
// after
stop { mode = "never" }
Defensive patterns

Strategy: validation

Validate before calling

if (stopMode != StopConfig.StopMode.NEVER && stopMode != StopConfig.StopMode.LATEST
    && stopMode != StopConfig.StopMode.SPECIFIC && stopMode != StopConfig.StopMode.TIMESTAMP) {
    throw new IllegalArgumentException("unsupported stop mode: " + stopMode);
}

Type guard

boolean isSupportedStopMode(StopConfig.StopMode m) {
    return EnumSet.of(StopConfig.StopMode.NEVER, StopConfig.StopMode.LATEST,
        StopConfig.StopMode.SPECIFIC, StopConfig.StopMode.TIMESTAMP).contains(m);
}

Prevention

When it happens

Trigger: Calling getStopOffset with a stop.mode resolving to an enum constant outside NEVER/LATEST/SPECIFIC/TIMESTAMP — e.g. a mode added in a different version or produced by faulty config parsing.

Common situations: Version mismatch between connector-cdc-base and the CDC connector module; hand-built StopConfig with an enum variant the switch predates; typo mapping in mode parsing.

Related errors


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