alibaba/nacos · error · NacosException
{response.getErrorCode()}
{response.getErrorCode()}
Error message
http error, code={response.getErrorCode()},msg={response.getMessage()},dataId={dataId},group={group},tenant={tenant} What it means
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).
Source
Thrown at client/src/main/java/com/alibaba/nacos/client/config/impl/ClientWorker.java:1362
return configResponse;
} else if (response.getErrorCode() == ConfigQueryResponse.CONFIG_NOT_FOUND) {
LocalConfigInfoProcessor.saveSnapshot(this.getName(), dataId, group, tenant, null);
LocalEncryptedDataKeyProcessor.saveEncryptDataKeySnapshot(agent.getName(), dataId,
group, tenant, null);
return configResponse;
} else if (response.getErrorCode() == ConfigQueryResponse.CONFIG_QUERY_CONFLICT) {
LOGGER.error(
"[{}] [sub-server-error] get server config being modified concurrently, dataId={}, group={}, "
+ "tenant={}",
this.getName(), dataId, group, tenant);
throw new NacosException(NacosException.CONFLICT,
"data being modified, dataId=" + dataId + ",group=" + group + ",tenant="
+ tenant);
} else {
LOGGER.error("[{}] [sub-server-error] dataId={}, group={}, tenant={}, code={}",
this.getName(), dataId,
group, tenant, response);
throw new NacosException(response.getErrorCode(),
"http error, code=" + response.getErrorCode() + ",msg="
+ response.getMessage() + ",dataId="
+ dataId + ",group=" + group + ",tenant=" + tenant);
}
}
Response requestProxy(RpcClient rpcClientInner, Request request) throws NacosException {
return requestProxy(rpcClientInner, request, requestTimeout);
}
private Response requestProxy(RpcClient rpcClientInner, Request request, long timeoutMills)
throws NacosException {
try {
request.putAllHeader(super.getSecurityHeaders(resourceBuild(request)));
request.putAllHeader(super.getCommonHeader());
} catch (Exception e) {
throw new NacosException(NacosException.CLIENT_INVALID_PARAM, e);View on GitHub (pinned to 9b989acdf1)
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.
Defensive patterns
Strategy: try-catch
Validate before calling
ParamUtils.checkKeyParam(dataId, group); // surface 400 before the call
Try / catch
try {
content = configService.getConfig(dataId, group, timeout);
} catch (NacosException e) {
switch (e.getErrCode()) {
case NacosException.NO_RIGHT: refreshCredentials(); break;
case NacosException.INVALID_PARAM: fixDataIdOrGroup(); break;
case NacosException.SERVER_ERROR: checkServerLogs(); break;
default: throw e;
}
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- [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}
- [NACOS HTTP-DELETE] The maximum number of tolerable server r
AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14).
Data as JSON: /api/errors/8ef5ee608c5bbdc0.
Report an issue: GitHub.