{"record":{"id":"3d4f0a2ed7ec5239","repo":"alibaba/nacos","slug":"500-3d4f0a","errorCode":"500","errorMessage":"Unknown Exception.","messagePattern":"Unknown Exception\\.","errorType":"exception","errorClass":"NacosException","httpStatus":null,"severity":"error","filePath":"common/src/main/java/com/alibaba/nacos/common/remote/client/RpcClient.java","lineNumber":676,"sourceCode":"     * @return response from server.\n     */\n    public Response request(Request request, long timeoutMills) throws NacosException {\n        int retryTimes = 0;\n        Response response;\n        Throwable exceptionThrow = null;\n        long start = System.currentTimeMillis();\n        while (retryTimes <= rpcClientConfig.retryTimes() && (timeoutMills <= 0\n            || System.currentTimeMillis() < timeoutMills + start)) {\n            boolean waitReconnect = false;\n            try {\n                if (this.currentConnection == null || !isRunning()) {\n                    waitReconnect = true;\n                    throw new NacosException(NacosException.CLIENT_DISCONNECT,\n                        \"Client not connected, current status:\" + rpcClientStatus.get());\n                }\n                response = this.currentConnection.request(request, timeoutMills);\n                if (response == null) {\n                    throw new NacosException(SERVER_ERROR, \"Unknown Exception.\");\n                }\n                if (response instanceof ErrorResponse) {\n                    if (response.getErrorCode() == NacosException.UN_REGISTER) {\n                        synchronized (this) {\n                            waitReconnect = true;\n                            if (rpcClientStatus.compareAndSet(RpcClientStatus.RUNNING,\n                                RpcClientStatus.UNHEALTHY)) {\n                                LoggerUtils.printIfErrorEnabled(LOGGER,\n                                    \"Connection is unregistered, switch server, connectionId = {}, request = {}\",\n                                    currentConnection.getConnectionId(),\n                                    request.getClass().getSimpleName());\n                                switchServerAsync();\n                            }\n                        }\n                        \n                    }\n                    throw new NacosException(response.getErrorCode(), response.getMessage());\n                }","sourceCodeStart":658,"sourceCodeEnd":694,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/common/src/main/java/com/alibaba/nacos/common/remote/client/RpcClient.java#L658-L694","documentation":"RpcClient.request() throws SERVER_ERROR (500) 'Unknown Exception.' when currentConnection.request() returns a non-null but effectively unusable response object — specifically null parsed into the `response` variable path. It signals the transport returned nothing usable rather than an explicit server-side error payload.","triggerScenarios":"The underlying connection.request() invocation returns null (e.g. gRPC future returned null Payload, or parse produced null) but did not throw. The retry loop then treats this as a transient failure and retries; after exhausting retries it surfaces 'Unknown Exception.' only on the iteration itself, with -500.","commonSituations":"Transient gRPC channel issues that yield a null payload without an exception (rare); a malformed or empty response from a misbehaving/older server version; interceptor chain stripping the payload; netty buffer exhaustion returning an empty frame.","solutions":["Enable DEBUG/ERROR logging on the RpcClient and GrpcConnection to capture the underlying future result and channel state at failure time.","Confirm client and server gRPC/protobuf versions are compatible (mismatched stubs can yield unparseable null responses).","Retry with backoff; this is typically transient, so increasing retryTimes and timeoutMills gives the channel time to recover.","If persistent, capture a server-side log/thread dump to confirm the server actually produced a response payload."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    response = client.request(req, timeout);\n} catch (NacosException ne) {\n    if (ne.getErrCode() == NacosException.SERVER_ERROR) {\n        // back off and retry; inspect logs for null-payload cause\n    } else { throw ne; }\n}","preventionTips":["Keep client/server gRPC and protobuf versions aligned.","Enable ERROR logging on the RPC client to capture underlying future results.","Treat null-response failures as transient and retry with backoff."],"tags":["rpc-client","grpc","server-error","transport","transient"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}