{"record":{"id":"56372c1fe3ba66fe","repo":"alibaba/nacos","slug":"server-error-56372c","errorCode":"SERVER_ERROR","errorMessage":"{unexpectedExceptionMessage}","messagePattern":"\\{unexpectedExceptionMessage\\}","errorType":"exception","errorClass":"NacosException","httpStatus":500,"severity":"error","filePath":"plugin-default-impl/nacos-default-auth-plugin/src/main/java/com/alibaba/nacos/plugin/auth/impl/visibility/RemoteVisibilityGrantService.java","lineNumber":78,"sourceCode":"    }\n    \n    @Override\n    public void grant(String namespaceId, String resourceType, String resourceName, String username,\n        String action) throws NacosException {\n        Map<String, String> body = new LinkedHashMap<>(4);\n        body.put(\"resourceType\", resourceType);\n        body.put(\"resourceName\", resourceName);\n        body.put(\"username\", username);\n        body.put(\"action\", action);\n        try {\n            HttpRestResult<String> result = nacosRestTemplate.postForm(buildRemoteUrl(),\n                buildForwardedIdentityHeader(), buildForwardedAccessTokenQuery(namespaceId), body,\n                String.class);\n            RemoteServerUtil.singleCheckResult(result);\n        } catch (NacosException e) {\n            throw e;\n        } catch (Exception unexpectedException) {\n            throw new NacosException(NacosException.SERVER_ERROR,\n                unexpectedException.getMessage());\n        }\n    }\n    \n    @Override\n    public void revoke(String namespaceId, String resourceType, String resourceName,\n        String username, String action) throws NacosException {\n        Query query = buildForwardedAccessTokenQuery(namespaceId).addParam(\"resourceType\",\n            resourceType).addParam(\"resourceName\", resourceName).addParam(\"username\", username)\n            .addParam(\"action\", action);\n        try {\n            HttpRestResult<String> result = nacosRestTemplate.delete(buildRemoteUrl(),\n                buildForwardedIdentityHeader(), query, String.class);\n            RemoteServerUtil.singleCheckResult(result);\n        } catch (NacosException e) {\n            throw e;\n        } catch (Exception unexpectedException) {\n            throw new NacosException(NacosException.SERVER_ERROR,","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/plugin-default-impl/nacos-default-auth-plugin/src/main/java/com/alibaba/nacos/plugin/auth/impl/visibility/RemoteVisibilityGrantService.java#L60-L96","documentation":"Thrown by RemoteVisibilityGrantService.grant() when the remote HTTP POST to grant visibility fails with an exception that is NOT a NacosException — e.g. network IOException, connection timeout, SSL error, or form-encoding failure. Unlike NacosUserServiceRemoteImpl, this class re-throws NacosException as-is (not wrapping in NacosRuntimeException), and only wraps non-Nacos exceptions as NacosException with SERVER_ERROR code. Used in standalone console deployments that forward requests to a remote server.","triggerScenarios":"Calling grant() on RemoteVisibilityGrantService when the remote server is unreachable, the connection times out, or the HTTP client encounters a transport-level error during the POST to the visibility API endpoint.","commonSituations":"Network partition between the standalone console and the Nacos server; cluster.conf points to an unreachable address; SSL/TLS misconfiguration; the forwarded identity header or access token is missing causing a non-Nacos-level rejection.","solutions":["Verify network connectivity from the console node to all server addresses in cluster.conf.","Check the exception message (in NacosException.getErrMsg()) for transport-specific error keywords.","Ensure the buildRemoteUrl() resolves to a valid, reachable endpoint.","Verify that buildForwardedIdentityHeader() and buildForwardedAccessTokenQuery() correctly capture and forward the caller's credentials."],"exampleFix":"// No code fix — runtime/network error. Diagnose via:\n// curl -X POST http://<server>/nacos/v3/auth/visibility \\\n//   -H \"Authorization: Bearer <token>\" \\\n//   -d \"resourceType=config&resourceName=app.yml&username=alice&action=r\"","handlingStrategy":"try-catch","validationCode":"// Verify connectivity before the grant call\nString serverAddr = RemoteServerUtil.getOneNacosServerAddress();\nif (serverAddr == null) {\n    throw new NacosException(NacosException.SERVER_ERROR,\n        \"No remote server address available\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    visibilityService.grant(namespaceId, resourceType, resourceName, username, action);\n} catch (NacosException e) {\n    if (e.getErrCode() == NacosException.SERVER_ERROR) {\n        // transport-level failure — check network and server identity config\n        log.error(\"Visibility grant remote call failed: {}\", e.getMessage());\n    }\n    throw e;\n}","preventionTips":["Ensure cluster.conf lists only reachable server addresses.","Verify the forwarded identity header and access token are populated from the current request context.","Monitor network health between standalone console and server nodes."],"tags":["auth","visibility","remote-call","network","standalone-console"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}