{"record":{"id":"c94e5401bf94e645","repo":"apache/shenyu","slug":"e-getmessage-polarisdatachangedlistener","errorCode":null,"errorMessage":"e.getMessage()","messagePattern":"e\\.getMessage\\(\\)","errorType":"exception","errorClass":"ShenyuException","httpStatus":null,"severity":"error","filePath":"shenyu-admin-listener/shenyu-admin-listener-polaris/src/main/java/org/apache/shenyu/admin/listener/polaris/PolarisDataChangedListener.java","lineNumber":88,"sourceCode":"            configFilePublishService.releaseConfigFile(metadata);\n        } catch (PolarisException e) {\n            LOG.error(\"Polaris Publish data to polaris error.\", e);\n        }\n    }\n\n    @Override\n    public void doDelConfig(final String dataId) {\n        doPublishConfig(dataId, null);\n    }\n\n    @Override\n    public String getConfig(final String dataId) {\n        try {\n            ConfigFile configFile = configFileService.getConfigFile(polarisProperties.getNamespace(), polarisProperties.getFileGroup(), dataId);\n            return configFile.hasContent() ? configFile.getContent() : null;\n        } catch (PolarisException e) {\n            LOG.error(\"Polaris Get data from polaris error.\", e);\n            throw new ShenyuException(e.getMessage());\n        }\n    }\n\n    private boolean isReleased(final DefaultConfigFileMetadata metadata) {\n        try {\n            return Objects.nonNull(configFileService.getConfigFile(metadata).getContent());\n        } catch (PolarisException e) {\n            LOG.error(\"Polaris Get data from polaris error.\", e);\n            throw new ShenyuException(e.getMessage());\n        }\n    }\n}\n","sourceCodeStart":70,"sourceCodeEnd":101,"githubUrl":"https://github.com/apache/shenyu/blob/567142e07261b3e615ae8850b30f4421f455cc5d/shenyu-admin-listener/shenyu-admin-listener-polaris/src/main/java/org/apache/shenyu/admin/listener/polaris/PolarisDataChangedListener.java#L70-L101","documentation":"PolarisDataChangedListener.getConfig fetches a config file by dataId from Polaris; any PolarisException (cluster unreachable, auth error, invalid namespace/group) is wrapped in ShenyuException with only e.getMessage(). The caller loses the stack trace of the underlying failure. A missing file is NOT an error here — it returns null; only genuine Polaris API failures throw.","triggerScenarios":"Calling getConfig(dataId) on the PolarisDataChangedListener when the Polaris API throws: server down, bad namespace/fileGroup, auth/token failure, or network timeout.","commonSituations":"Admin started before Polaris is available; wrong polaris namespace/file-group in yml; expired Polaris auth token; DNS resolution failure inside k8s.","solutions":["Confirm polaris address/namespace/file-group configuration in shenyu-admin yml matches the actual Polaris setup","Verify the Polaris cluster is reachable from the admin process (network, DNS, port)","Check the LOG.error line 'Polaris Get data from polaris error.' for the underlying root cause","Restart/retry once the Polaris cluster is healthy — config sync retries depend on this call succeeding"],"exampleFix":"// before\n} catch (PolarisException e) {\n    LOG.error(\"Polaris Get data from polaris error.\", e);\n    throw new ShenyuException(e.getMessage());\n}\n// after\n} catch (PolarisException e) {\n    LOG.error(\"Polaris Get data from polaris error.\", e);\n    throw new ShenyuException(\"Polaris get config failed for dataId: \" + e.getMessage(), e);\n}","handlingStrategy":"try-catch","validationCode":"// pre-check config presence without throwing\nboolean ok;\ntry {\n    ok = configFileService.getConfigFile(ns, group, dataId) != null;\n} catch (Exception e) { ok = false; }\nif (!ok) { /* skip or reconnect */ }","typeGuard":null,"tryCatchPattern":"try {\n    String cfg = listener.getConfig(dataId);\n} catch (ShenyuException e) {\n    LOG.warn(\"Polaris getConfig failed: {}\", e.getMessage(), e);\n    // treat as transient: retry later or use cached value\n}","preventionTips":["Pre-validate polaris connection settings at startup","Distinguish 'missing file returns null' from 'API throws' in caller logic","Add retries with backoff for transient Polaris outages"],"tags":["polaris","config-sync","network","configuration"],"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"}