{"record":{"id":"88c4bd4398eef5c4","repo":"alibaba/nacos","slug":"400-88c4bd","errorCode":"400","errorMessage":"no server available","messagePattern":"no server available","errorType":"exception","errorClass":"NacosException","httpStatus":400,"severity":"critical","filePath":"client/src/main/java/com/alibaba/nacos/client/naming/remote/http/NamingHttpClientProxy.java","lineNumber":385,"sourceCode":"    /**\n     * Request api.\n     *\n     * @param api     api\n     * @param params  parameters\n     * @param body    body\n     * @param servers servers\n     * @param method  http method\n     * @return result\n     * @throws NacosException nacos exception\n     */\n    public String reqApi(String api, Map<String, String> params, Map<String, String> body,\n        List<String> servers,\n        String method) throws NacosException {\n        \n        params.put(CommonParams.NAMESPACE_ID, getNamespaceId());\n        \n        if (CollectionUtils.isEmpty(servers) && !serverListManager.isDomain()) {\n            throw new NacosException(NacosException.INVALID_PARAM, \"no server available\");\n        }\n        \n        NacosException exception = new NacosException();\n        if (serverListManager.isDomain()) {\n            String nacosDomain = serverListManager.getNacosDomain();\n            for (int i = 0; i < maxRetry; i++) {\n                try {\n                    return callServer(api, params, body, nacosDomain, method);\n                } catch (NacosException e) {\n                    exception = e;\n                    if (NAMING_LOGGER.isDebugEnabled()) {\n                        NAMING_LOGGER.debug(\"request {} failed.\", nacosDomain, e);\n                    }\n                }\n            }\n        } else {\n            int index = ThreadLocalRandom.current().nextInt(servers.size());\n            ","sourceCodeStart":367,"sourceCodeEnd":403,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/client/src/main/java/com/alibaba/nacos/client/naming/remote/http/NamingHttpClientProxy.java#L367-L403","documentation":"Thrown by NamingHttpClientProxy.reqApi when the server list is empty and the client is not in domain mode (NacosException.INVALID_PARAM = 400). The HTTP proxy has no server to send the request to. This fires before any retry logic because there is nothing to retry against.","triggerScenarios":"The ServerListManager has not yet retrieved any server addresses (or all were removed) and no domain/virtual-IP is configured. Any naming HTTP API call (register, query, etc.) will immediately fail.","commonSituations":"Startup race where the client sends a naming request before the server list has been fetched; misconfigured server address property (empty or unparseable); the Nacos server endpoint is unreachable during initial server-list discovery; the server list was cleared by a failed health-check sweep.","solutions":["Verify the serverAddr property in the client configuration points to a reachable Nacos server.","Ensure the server list is populated before issuing naming requests — add a startup delay or readiness check.","If using a domain/VIP, confirm serverListManager.isDomain() returns true so the domain path is used instead of the server-list path."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Ensure server list is populated before issuing naming requests\nServerListManager slm = ...; // from client internals\nif (slm.getServerList().isEmpty() && !slm.isDomain()) {\n    throw new IllegalStateException(\"No Nacos server available — check serverAddr config\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    namingService.registerInstance(serviceName, instance);\n} catch (NacosException e) {\n    if (e.getErrCode() == NacosException.INVALID_PARAM\n        && \"no server available\".equals(e.getErrMsg())) {\n        // wait for server list to populate, then retry\n        Thread.sleep(2000);\n        namingService.registerInstance(serviceName, instance);\n    } else {\n        throw e;\n    }\n}","preventionTips":["Verify the serverAddr property is correctly set to a reachable Nacos server before starting the client.","Add a readiness check that the server list is non-empty before issuing naming operations.","Use a domain/VIP configuration for high-availability clusters."],"tags":["naming","http-proxy","no-server","configuration","startup"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}