alibaba/nacos · warning · UnsupportedOperationException
not support to cancel fuzzy watch
Error message
not support to cancel fuzzy watch
What it means
Thrown as UnsupportedOperationException by the Future returned from ConfigFuzzyWatchContext.createNewFuture().cancel(). Fuzzy watch does not support cancellation — the context tracks initialization completion driven by the server, so a client cannot abort it. Calling cancel() is an API misuse; isCancelled() always returns false.
Source
Thrown at client/src/main/java/com/alibaba/nacos/client/config/impl/ConfigFuzzyWatchContext.java:515
FUZZY_WATCH_DIFF_SYNC_NOTIFY,
configFuzzyWatcher);
}
}
}
}
/**
* creat a new future of this context.
*
* @return
*/
public Future<Set<String>> createNewFuture() {
Future<Set<String>> future = new Future<Set<String>>() {
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
throw new UnsupportedOperationException("not support to cancel fuzzy watch");
}
@Override
public boolean isCancelled() {
return false;
}
@Override
public boolean isDone() {
return ConfigFuzzyWatchContext.this.initializationCompleted.get();
}
@Override
public Set<String> get() throws InterruptedException, ExecutionException {
synchronized (ConfigFuzzyWatchContext.this) {
while (!ConfigFuzzyWatchContext.this.initializationCompleted.get()) {
ConfigFuzzyWatchContext.this.wait();
}View on GitHub (pinned to 9b989acdf1)
Solutions
- Do not call cancel() on the fuzzy-watch future; treat it as non-cancellable.
- If using a framework that cancels, wrap the future to no-op cancel().
- Rely on the timeout overload of get(timeout, unit) instead of cancel for bounded waits.
Example fix
// before
Future<Set<String>> f = context.createNewFuture();
if (!f.isDone()) f.cancel(true);
// after
Future<Set<String>> f = context.createNewFuture();
try {
Set<String> keys = f.get(5, TimeUnit.SECONDS);
} catch (TimeoutException te) {
// give up the bounded wait; do NOT call f.cancel() Defensive patterns
Strategy: type-guard
Type guard
// never call cancel() on a fuzzy-watch future; it is non-cancellable
static boolean isCancellable(Future<?> f) {
return false; // for fuzzy watch contexts
} Try / catch
// do not catch UnsupportedOperationException from cancel — avoid calling cancel
Set<String> keys;
try {
keys = future.get(timeout, unit);
} catch (TimeoutException | InterruptedException e) {
// bounded wait expired; do NOT future.cancel() Prevention
- Never invoke cancel() on a fuzzy-watch future.
- Use get(timeout, unit) for bounded waits instead of cancel.
- Wrap the future if a framework insists on cancelling.
When it happens
Trigger: Taking the Future<Set<String>> from a fuzzy watch context and invoking future.cancel(true/false) on it, e.g. via a generic task runner that cancels futures on timeout.
Common situations: Integrating fuzzy watch into a framework (CompletableFuture composition, scheduled executor) that automatically cancels child futures, or explicit cancel-on-timeout logic.
Related errors
- fuzzy watch result future timeout for {unit.toMillis(timeout
- [NACOS HTTP-GET] The maximum number of tolerable server reco
- no available server
- [NACOS HTTP-POST] The maximum number of tolerable server rec
- no available server, currentServerAddr : {currentServerAddr}
AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14).
Data as JSON: /api/errors/4cb3d33bd9633cf2.
Report an issue: GitHub.