alibaba/nacos · error · NacosException
{}
{}
Error message
{} What it means
Thrown by GrpcConnection.RequestFuture.get() when the gRPC server returns an ErrorResponse payload instead of a normal Response. The error code and message are taken verbatim from the server-side response (response.getErrorCode(), response.getMessage()), so the '{}' placeholders are filled at runtime. This is the synchronous (non-timed) path of a client-side gRPC request: the call completed on the wire, but the server deliberately reported a logical failure.
Source
Thrown at common/src/main/java/com/alibaba/nacos/common/remote/client/grpc/GrpcConnection.java:104
@Override
public RequestFuture requestFuture(Request request) throws NacosException {
Payload grpcRequest = GrpcUtils.convert(request);
final ListenableFuture<Payload> requestFuture = grpcFutureServiceStub.request(grpcRequest);
return new RequestFuture() {
@Override
public boolean isDone() {
return requestFuture.isDone();
}
@Override
public Response get() throws Exception {
Payload grpcResponse = requestFuture.get();
Response response = (Response) GrpcUtils.parse(grpcResponse);
if (response instanceof ErrorResponse) {
throw new NacosException(response.getErrorCode(), response.getMessage());
}
return response;
}
@Override
public Response get(long timeout) throws Exception {
Payload grpcResponse = requestFuture.get(timeout, TimeUnit.MILLISECONDS);
Response response = (Response) GrpcUtils.parse(grpcResponse);
if (response instanceof ErrorResponse) {
throw new NacosException(response.getErrorCode(), response.getMessage());
}
return response;
}
};
}
public void sendResponse(Response response) {
Payload convert = GrpcUtils.convert(response);View on GitHub (pinned to 9b989acdf1)
Solutions
- Inspect NacosException.getErrCode() and getMessage() in the catch block — the real cause is server-supplied, not the placeholder '{}' literal.
- Verify client and server run compatible Nacos versions (same major, ideally same minor); a version skew is the most common source of unexpected ErrorResponse values.
- Check server logs for the matching request handling error to identify whether it is auth, validation, or capacity.
- If the request targets a specific namespace/group/dataId, confirm the resource exists and the credentials used have the required permission.
Example fix
// before
RequestFuture future = connection.request(request);
Response resp = future.get(); // raw, uncaught NacosException
// after
RequestFuture future = connection.request(request);
try {
Response resp = future.get();
} catch (NacosException e) {
log.warn("gRPC request failed errCode={} msg={}", e.getErrCode(), e.getErrorMsg());
// route to caller as a typed domain error
throw e;
} Defensive patterns
Strategy: try-catch
Try / catch
RequestFuture future = connection.request(request);
try {
Response resp = future.get();
} catch (NacosException e) {
// errCode + message come from the server ErrorResponse
log.warn("request rejected by server: code={}, msg={}", e.getErrCode(), e.getErrorMsg());
throw e;
} Prevention
- Always wrap RequestFuture.get() in a try-catch for NacosException; the server-side code is the actionable signal.
- Keep client and server Nacos versions aligned to avoid unexpected ErrorResponse types.
- Log both errCode and message — the placeholder '{}' in source is filled at runtime.
When it happens
Trigger: Calling connection.request(req).get() (the no-arg blocking get) on a GrpcConnection where the server responds with a payload whose deserialized type extends ErrorResponse. This happens for any server-rejected request: unsupported server capability, invalid parameters caught server-side, resource-not-found, over-capacity, or auth denial surfaced as an ErrorResponse.
Common situations: Client/server Nacos version mismatch where the server no longer understands a request type; sending a request to a namespace or resource the caller lacks permission for; server-side validation rejecting malformed request fields; server overloaded returning a pushed-back ErrorResponse.
Related errors
- request timeout after {timeout} milliseconds, requestId={req
- {e.getErrCode()}
- 500
- 10000
- PARAMETER_MISSING
AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14).
Data as JSON: /api/errors/39767b009a4f3898.
Report an issue: GitHub.