alibaba/nacos · error · IllegalArgumentException

The addressing mode exists : {name}, just support : [{Arrays

Error message

The addressing mode exists : {name}, just support : [{Arrays.toString(LookupType.values())}]

What it means

Thrown by LookupFactory.switchLookup when the requested member-addressing (cluster discovery) mode name does not match a known LookupType. The LookupType enum only defines two lookup names: 'file' (cluster.conf) and 'address-server' (Nacos address server). Note the message text is misleading: it says the mode 'exists' but actually means the mode is UNRECOGNIZED/unsupported, and it lists the supported values.

Source

Thrown at core/src/main/java/com/alibaba/nacos/core/cluster/lookup/LookupFactory.java:90

        Loggers.CLUSTER.info("Current addressing mode selection : {}",
            LOOK_UP.getClass().getSimpleName());
        return LOOK_UP;
    }
    
    /**
     * Switch to target addressing mode.
     *
     * @param name          target member-lookup name
     * @param memberManager {@link ServerMemberManager}
     * @return {@link MemberLookup}
     * @throws NacosException {@link NacosException}
     */
    public static MemberLookup switchLookup(String name, ServerMemberManager memberManager)
        throws NacosException {
        LookupType lookupType = LookupType.sourceOf(name);
        
        if (Objects.isNull(lookupType)) {
            throw new IllegalArgumentException(
                "The addressing mode exists : " + name + ", just support : ["
                    + Arrays.toString(LookupType.values())
                    + "]");
        }
        
        if (Objects.equals(currentLookupType, lookupType)) {
            return LOOK_UP;
        }
        MemberLookup newLookup = find(lookupType);
        currentLookupType = lookupType;
        if (Objects.nonNull(LOOK_UP)) {
            LOOK_UP.destroy();
        }
        LOOK_UP = newLookup;
        LOOK_UP.injectMemberManager(memberManager);
        Loggers.CLUSTER.info("Current addressing mode selection : {}",
            LOOK_UP.getClass().getSimpleName());
        return LOOK_UP;

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Use one of the supported lookup names: 'file' (read cluster members from cluster.conf) or 'address-server' (pull members from the address server).
  2. If you intended a custom MemberLookup SPI implementation, confirm the SPI is registered and that its lookup name is returned by a LookupType you added; built-in Nacos only ships the two above.
  3. Check the LookupUpdateRequest payload serialization so the 'type' field is not null, whitespace, or mangled by JSON binding.

Example fix

// before
PUT /v3/admin/core/cluster/lookup
{"type": "config"}

// after
PUT /v3/admin/core/cluster/lookup
{"type": "file"}
Defensive patterns

Strategy: validation

Validate before calling

private static final Set<String> VALID_LOOKUP = Set.of("file", "address-server");
if (!VALID_LOOKUP.contains(request.getType())) {
    // reject before calling switchLookup / the API
    throw new IllegalArgumentException("Unsupported lookup type: " + request.getType());
}

Try / catch

try {
    LookupFactory.switchLookup(type, memberManager);
} catch (IllegalArgumentException e) {
    // type not supported; surface supported values to the operator
}

Prevention

When it happens

Trigger: Calling PUT /v3/admin/core/cluster/lookup with a LookupUpdateRequest whose 'type' field is any string other than 'file' or 'address-server' (e.g. 'none', 'dns', 'config', empty after trim). Internally LookupType.sourceOf(name) iterates the enum and matches the 'name' field (not the enum constant), returning null when no match is found.

Common situations: Operator typo in the addressing-mode switch API; assuming the type value is the enum constant name ('FILE_CONFIG'/'ADDRESS_SERVER') instead of the lookup name ('file'/'address-server'); sending a mode supported by an older/newer Nacos version against a server that only ships the two built-in lookup types.

Related errors


AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14). Data as JSON: /api/errors/7f32398e1d76ea36. Report an issue: GitHub.