apache/shenyu · error · NotImplementedException

shenyu discovery mode current didn't support

Error message

shenyu discovery mode current didn't support %s

What it means

DiscoveryProcessorHolder.chooseProcessor selects the DiscoveryProcessor implementation that handles upstream discovery for a discoveryConfig whose `mode` field is one of the DiscoveryMode enum values (local, zookeeper, nacos, eureka). If the configured mode matches none of the supported branches, it throws NotImplementedException. This means the admin's discovery configuration references a discovery mode the running ShenYu build cannot process.

Solutions

  1. Set the discovery config's mode to one of the supported values: local, zookeeper, nacos, or eureka (case-insensitive).
  2. Fix typos or stray whitespace in the mode field of the discovery_config row / dashboard form.
  3. If the mode is genuinely needed (e.g. etcd/consul discovery), upgrade ShenYu to a version that ships a DiscoveryProcessor for it, or implement and register a custom DiscoveryProcessor.
  4. Verify the mode reaches admin intact — check the REST payload in the admin logs before assuming the processor layer is at fault.

Example fix

// before
discoveryConfig.setMode("consul");
// after
discoveryConfig.setMode(DiscoveryMode.NACOS.name());
Defensive patterns

Strategy: validation

Validate before calling

java.util.Arrays.stream(DiscoveryMode.values())
    .map(Enum::name)
    .filter(m -> m.equalsIgnoreCase(mode))
    .findFirst()
    .orElseThrow(() -> new IllegalArgumentException("unsupported discovery mode: " + mode));

Try / catch

try {
    processor = DiscoveryProcessorHolder.getInstance().chooseProcessor(mode);
} catch (NotImplementedException e) {
    LOG.error("discovery mode {} not supported, falling back to local", mode, e);
}

Prevention

When it happens

Trigger: Calling chooseProcessor (via discovery config save/sync in shenyu-admin) with a discoveryConfig.mode that is not LOCAL, ZOOKEEPER, NACOS or EUREKA (case-insensitive) — e.g. mode set to CONSUL, ETCD or a typo like 'nacos ' or 'NacosX'.

Common situations: Dashboard/API request posting a discovery config with a hand-typed mode string; database seeded with a mode value from a newer ShenYu version that this build's DiscoveryMode/processor set doesn't support; mixing proxy plugin (e.g. websocket proxy uses eureka 'ap' discovery) configs across versions.

Related errors


AI-assisted analysis of apache/shenyu@567142e072 (2026-09-12). Data as JSON: /api/errors/103bf3f12cb4fba0. Report an issue: GitHub.

Appendix: source

Thrown at shenyu-admin/src/main/java/org/apache/shenyu/admin/discovery/DiscoveryProcessorHolder.java:57

    /**
     * chooseProcessor.
     *
     * @param mode mode
     * @return DiscoveryProcessor
     */
    public DiscoveryProcessor chooseProcessor(final String mode) {
        if (DiscoveryMode.LOCAL.name().equalsIgnoreCase(mode)) {
            return localDiscoveryProcessor;
        } else if (DiscoveryMode.ZOOKEEPER.name().equalsIgnoreCase(mode)) {
            return defaultDiscoveryProcessor;
        } else if (DiscoveryMode.ETCD.name().equalsIgnoreCase(mode)) {
            return defaultDiscoveryProcessor;
        } else if (DiscoveryMode.NACOS.name().equalsIgnoreCase(mode)) {
            return defaultDiscoveryProcessor;
        } else if (DiscoveryMode.EUREKA.name().equalsIgnoreCase(mode)) {
            return apDiscoveryProcessor;
        } else {
            throw new NotImplementedException("shenyu discovery mode current didn't support " + mode);
        }
    }

}

View on GitHub (pinned to 567142e072)