alibaba/nacos · error · NacosRuntimeException

500

500

Error message

unpectedException.getMessage()

What it means

Thrown by deletePermission's remote path when an unexpected (non-Nacos) exception occurs while calling nacosRestTemplate.delete or parsing the response. It is wrapped as a NacosRuntimeException with code NacosException.SERVER_ERROR (500) and the underlying exception's message. Typical root causes are network/IO failures, connection timeouts, or JSON deserialization errors rather than an application-level rejection.

Source

Thrown at plugin-default-impl/nacos-default-auth-plugin/src/main/java/com/alibaba/nacos/plugin/auth/impl/roles/NacosRoleServiceRemoteImpl.java:87

            throw new NacosRuntimeException(NacosException.SERVER_ERROR,
                unpectedException.getMessage());
        }
    }
    
    @Override
    public void deletePermission(String role, String resource, String action) {
        Query query = Query.newInstance().addParam("role", role).addParam("resource", resource)
            .addParam("action", action);
        try {
            HttpRestResult<String> result = nacosRestTemplate.delete(
                buildRemotePermissionUrlPath(AuthConstants.PERMISSION_PATH),
                RemoteServerUtil.buildServerRemoteHeader(), query, String.class);
            RemoteServerUtil.singleCheckResult(result);
            invalidateRolePermissions(role);
        } catch (NacosException e) {
            throw new NacosRuntimeException(e.getErrCode(), e.getErrMsg());
        } catch (Exception unpectedException) {
            throw new NacosRuntimeException(NacosException.SERVER_ERROR,
                unpectedException.getMessage());
        }
    }
    
    @Override
    public List<PermissionInfo> getPermissions(String role) {
        List<PermissionInfo> cached = getCachedPermissionInfoMap().get(role);
        if (cached != null) {
            return cached;
        }
        reload();
        return getCachedPermissionInfoMap().get(role);
    }
    
    @Override
    public Page<PermissionInfo> getPermissions(String role, int pageNo, int pageSize) {
        Query query = Query.newInstance().addParam("role", role).addParam("pageNo", pageNo)
            .addParam("pageSize", pageSize).addParam("search", "accurate");

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Check cluster.conf and ensure all listed server addresses are reachable from the console node.
  2. Inspect the wrapped exception's message/class for IO vs SSL vs parse errors.
  3. Restart or restore the unreachable node, then retry the delete.
  4. Verify inter-node network/firewall allows the server HTTP port.
Defensive patterns

Strategy: retry

Try / catch

try {
    roleService.deletePermission(role, resource, action);
} catch (NacosRuntimeException e) {
    if (e.getCode() == NacosException.SERVER_ERROR) {
        // transport/IO failure; retry against a healthy node after backoff
        retryWithBackoff(() -> roleService.deletePermission(role, resource, action));
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: The target Nacos server node is unreachable, the HTTP connection times out or is reset, the response body is malformed (cannot be parsed), or an SSL/TLS handshake fails during the forwarded DELETE.

Common situations: cluster.conf lists a dead/unreachable node; network partition between console and server nodes; firewall dropping the inter-node port; expired/mismatched TLS certs; node temporarily down for restart.

Related errors


AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14). Data as JSON: /api/errors/71bf67f33628d73c. Report an issue: GitHub.