alibaba/nacos · error · NacosException

INVALID_PARAM

INVALID_PARAM

Error message

Unsupported request type %s

What it means

Thrown by NamingFuzzyWatchRequestHandler.handle() when a fuzzy-watch gRPC request has a watchType other than INIT_WATCH or CANCEL_WATCH. The switch covers only those two; any other value hits default and raises NacosException.INVALID_PARAM with the bad watchType. Usually a client/server version mismatch on the fuzzy-watch feature.

Source

Thrown at naming/src/main/java/com/alibaba/nacos/naming/remote/rpc/handler/NamingFuzzyWatchRequestHandler.java:95

                
                boolean reachToUpLimit =
                    namingFuzzyWatchContextService.reachToUpLimit(groupKeyPattern);
                if (reachToUpLimit) {
                    NamingFuzzyWatchResponse namingFuzzyWatchResponse =
                        new NamingFuzzyWatchResponse();
                    namingFuzzyWatchResponse.setErrorInfo(
                        FUZZY_WATCH_PATTERN_MATCH_COUNT_OVER_LIMIT.getCode(),
                        FUZZY_WATCH_PATTERN_MATCH_COUNT_OVER_LIMIT.getMsg());
                    return namingFuzzyWatchResponse;
                }
                
                return NamingFuzzyWatchResponse.buildSuccessResponse();
            case WATCH_TYPE_CANCEL_WATCH:
                namingFuzzyWatchContextService.removeFuzzyWatchContext(groupKeyPattern,
                    meta.getConnectionId());
                return NamingFuzzyWatchResponse.buildSuccessResponse();
            default:
                throw new NacosException(NacosException.INVALID_PARAM,
                    String.format("Unsupported request type %s", request.getWatchType()));
        }
    }
}

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Set watchType to a supported value (INIT_WATCH to start, CANCEL_WATCH to stop).
  2. Upgrade/align client and server to the same Nacos version.
  3. Confirm the fuzzy-watch feature is enabled on the server before using it.

Example fix

// before
NamingFuzzyWatchRequest req = new NamingFuzzyWatchRequest(pattern, 99);
// after
NamingFuzzyWatchRequest req = new NamingFuzzyWatchRequest(pattern,
    NamingFuzzyWatchRequest.WatchType.INIT_WATCH);
Defensive patterns

Strategy: type-guard

Validate before calling

int w = request.getWatchType();
if (w != NamingFuzzyWatchRequest.WatchType.INIT_WATCH.getType()
    && w != NamingFuzzyWatchRequest.WatchType.CANCEL_WATCH.getType()) {
    throw new IllegalArgumentException("Unsupported fuzzy-watch watchType: " + w);
}

Type guard

static boolean isSupportedWatchType(int t) {
    return t == NamingFuzzyWatchRequest.WatchType.INIT_WATCH.getType()
        || t == NamingFuzzyWatchRequest.WatchType.CANCEL_WATCH.getType();
}

Try / catch

try {
    client.fuzzyWatch(pattern, listener);
} catch (NacosException e) {
    if (e.getErrCode() == NacosException.INVALID_PARAM
        && e.getMessage().contains("Unsupported request type")) {
        // verify server supports fuzzy-watch and versions match
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Client sends a NamingFuzzyWatchRequest whose watchType is not a recognized constant.

Common situations: Client SDK and server on different versions where fuzzy-watch constants diverged; an old client against a new server (or vice versa) that does not know the watchType values; a custom gRPC client sending the wrong enum/integer.

Related errors


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