{"record":{"id":"8ef5ee608c5bbdc0","repo":"alibaba/nacos","slug":"response-geterrorcode","errorCode":"{response.getErrorCode()}","errorMessage":"http error, code={response.getErrorCode()},msg={response.getMessage()},dataId={dataId},group={group},tenant={tenant}","messagePattern":"http error, code=(.+?),msg=(.+?),dataId=(.+?),group=(.+?),tenant=(.+?)","errorType":"exception","errorClass":"NacosException","httpStatus":null,"severity":"error","filePath":"client/src/main/java/com/alibaba/nacos/client/config/impl/ClientWorker.java","lineNumber":1362,"sourceCode":"                return configResponse;\n            } else if (response.getErrorCode() == ConfigQueryResponse.CONFIG_NOT_FOUND) {\n                LocalConfigInfoProcessor.saveSnapshot(this.getName(), dataId, group, tenant, null);\n                LocalEncryptedDataKeyProcessor.saveEncryptDataKeySnapshot(agent.getName(), dataId,\n                    group, tenant, null);\n                return configResponse;\n            } else if (response.getErrorCode() == ConfigQueryResponse.CONFIG_QUERY_CONFLICT) {\n                LOGGER.error(\n                    \"[{}] [sub-server-error] get server config being modified concurrently, dataId={}, group={}, \"\n                        + \"tenant={}\",\n                    this.getName(), dataId, group, tenant);\n                throw new NacosException(NacosException.CONFLICT,\n                    \"data being modified, dataId=\" + dataId + \",group=\" + group + \",tenant=\"\n                        + tenant);\n            } else {\n                LOGGER.error(\"[{}] [sub-server-error]  dataId={}, group={}, tenant={}, code={}\",\n                    this.getName(), dataId,\n                    group, tenant, response);\n                throw new NacosException(response.getErrorCode(),\n                    \"http error, code=\" + response.getErrorCode() + \",msg=\"\n                        + response.getMessage() + \",dataId=\"\n                        + dataId + \",group=\" + group + \",tenant=\" + tenant);\n                \n            }\n        }\n        \n        Response requestProxy(RpcClient rpcClientInner, Request request) throws NacosException {\n            return requestProxy(rpcClientInner, request, requestTimeout);\n        }\n        \n        private Response requestProxy(RpcClient rpcClientInner, Request request, long timeoutMills)\n            throws NacosException {\n            try {\n                request.putAllHeader(super.getSecurityHeaders(resourceBuild(request)));\n                request.putAllHeader(super.getCommonHeader());\n            } catch (Exception e) {\n                throw new NacosException(NacosException.CLIENT_INVALID_PARAM, e);","sourceCodeStart":1344,"sourceCodeEnd":1380,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/client/src/main/java/com/alibaba/nacos/client/config/impl/ClientWorker.java#L1344-L1380","documentation":"Thrown by ClientWorker when a get-config request returns an error code other than success, NOT_FOUND, or CONFIG_QUERY_CONFLICT — the catch-all server error branch. The message embeds the server's errorCode, message, and the dataId/group/tenant. The thrown NacosException carries whatever errorCode the server returned, so the code field is dynamic (whatever response.getErrorCode() was).","triggerScenarios":"Server returns a ConfigQueryResponse with an unexpected error code (e.g. 400 INVALID_PARAM, 403 NO_RIGHT, 500 SERVER_ERROR) for a getConfig call that is not the not-found or conflict path.","commonSituations":"Authentication failure (403) due to an expired/invalid token, invalid dataId/group characters (400), a server-side exception (500), or a version/protocol mismatch producing an unrecognized code.","solutions":["Inspect the embedded code in the message: 403 -> fix credentials/token; 400 -> fix dataId/group; 500 -> check server logs.","For 403, ensure username/password or accessKey/secretKey are correct and the token is refreshed.","For 400, validate dataId/group with ParamUtils.checkKeyParam before the call.","For 500, consult the Nacos server log for the stack trace behind the response."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"ParamUtils.checkKeyParam(dataId, group); // surface 400 before the call","typeGuard":null,"tryCatchPattern":"try {\n    content = configService.getConfig(dataId, group, timeout);\n} catch (NacosException e) {\n    switch (e.getErrCode()) {\n        case NacosException.NO_RIGHT: refreshCredentials(); break;\n        case NacosException.INVALID_PARAM: fixDataIdOrGroup(); break;\n        case NacosException.SERVER_ERROR: checkServerLogs(); break;\n        default: throw e;\n    }\n}","preventionTips":["Map the embedded errorCode to the right remedy (403/400/500).","Keep credentials valid and tokens refreshed for 403.","Pre-validate dataId/group with ParamUtils to avoid 400."],"tags":["config","server-error","client","get-config"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}