{"record":{"id":"326b2c54f0f3b31c","repo":"apache/shenyu","slug":"e-getmessage","errorCode":null,"errorMessage":"e.getMessage()","messagePattern":"e\\.getMessage\\(\\)","errorType":"exception","errorClass":"ShenyuException","httpStatus":null,"severity":"error","filePath":"shenyu-admin-listener/shenyu-admin-listener-nacos/src/main/java/org/apache/shenyu/admin/listener/nacos/NacosDataChangedInit.java","lineNumber":67,"sourceCode":"        this.configService = configService;\n    }\n\n    @Override\n    protected boolean notExist() {\n        return Stream.of(NacosPathConstants.PLUGIN_DATA_ID, NacosPathConstants.AUTH_DATA_ID, NacosPathConstants.META_DATA_ID, NacosPathConstants.PROXY_SELECTOR_DATA_ID)\n                .map(NodeDataPathUtils::appendListStuff)\n                .allMatch(this::dataIdNotExist);\n    }\n\n    private boolean dataIdNotExist(final String pluginDataId) {\n        try {\n            return Objects.isNull(\n                    configService.getConfig(pluginDataId,\n                            NacosPathConstants.GROUP,\n                            NacosPathConstants.DEFAULT_TIME_OUT));\n        } catch (NacosException e) {\n            LOG.error(\"Get data from nacos error.\", e);\n            throw new ShenyuException(e.getMessage());\n        }\n    }\n\n}\n","sourceCodeStart":49,"sourceCodeEnd":72,"githubUrl":"https://github.com/apache/shenyu/blob/567142e07261b3e615ae8850b30f4421f455cc5d/shenyu-admin-listener/shenyu-admin-listener-nacos/src/main/java/org/apache/shenyu/admin/listener/nacos/NacosDataChangedInit.java#L49-L72","documentation":"NacosDataChangedInit.dataIdNotExist checks whether a plugin's dataId already exists in Nacos by calling configService.getConfig. On NacosException, the original message is wrapped in a ShenyuException and rethrown, surfacing Nacos client errors during the initial data check.","triggerScenarios":"Calling dataIdNotExist(pluginName) (during admin startup init) when the Nacos server is unreachable, credentials/namespace are wrong, or the Nacos SDK returns any NacosException (timeouts, connection refused, invalid group).","commonSituations":"Nacos server down or on a different host/port, wrong namespace configured, network/firewall blocking 8848, Nacos auth enabled but no credentials supplied, or group name mismatch.","solutions":["Check Nacos server address/namespace/group configuration (nacos.server-addr, namespace) in application.yml.","Verify Nacos is reachable: curl http://<nacos-host>:8848/nacos and check firewalls.","Read the wrapped e.getMessage() and LOG output — it carries the underlying NacosException reason; fix that cause.","If Nacos auth is enabled, supply username/password credentials for the config service."],"exampleFix":"// before\ntry { ... } catch (NacosException e) {\n    throw new ShenyuException(e.getMessage());\n}\n// after — surface cause chain for diagnosis\ncatch (NacosException e) {\n    throw new ShenyuException(\"Nacos config check failed for dataId \" + pluginDataId, e);\n}","handlingStrategy":"try-catch","validationCode":"// pre-check\nif (!nacosReachable(serverAddr, timeoutMs)) { throw new IllegalStateException(\"Nacos unreachable at \" + serverAddr); }","typeGuard":"null","tryCatchPattern":"try { return dataIdNotExist(pluginName); } catch (ShenyuException e) { log.error(\"Nacos init check failed: {}\", e.getMessage(), e); /* decide: abort startup or default to not-exist */ }","preventionTips":["Verify nacos server-addr/namespace/group before deploying admin.","Health-check Nacos in readiness probes before admin accepts traffic.","Enable Nacos client logging to capture errCode details.","Supply credentials when Nacos auth is enabled."],"tags":["nacos","config-sync","wrapped-exception"],"backgroundTag":"api-error-response","analyzedSha":"567142e07261b3e615ae8850b30f4421f455cc5d","analyzedAt":"2026-09-12T10:08:21.293Z","contentChangedAt":"2026-09-12T10:08:21.293Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}