apache/shenyu · error · ShenyuException

e.getMessage()

Error message

e.getMessage()

What it means

PolarisDataChangedInit wraps any PolarisException raised while checking whether a plugin config file exists in Polaris (via configFileService.getConfigFile) into a ShenyuException whose message is only the Polaris exception's message. The original stack trace is logged but lost in the rethrown exception. This aborts the initialization that decides whether plugin data must be uploaded to Polaris.

Solutions

  1. Verify shenyu.admin.polaris properties (address, namespace, file-group) point to a reachable Polaris server
  2. Check connectivity to the Polis cluster (curl/telnet the polaris address and port) and fix network/firewall issues
  3. Inspect the LOG.error output ('Get data from polaris error.') for the real root cause since the rethrown message is truncated
  4. Fix Polaris authentication/token if the wrapped message indicates auth failure

Example fix

// before
} catch (PolarisException e) {
    LOG.error("Get data from polaris error.", e);
    throw new ShenyuException(e.getMessage());
}
// after
} catch (PolarisException e) {
    LOG.error("Get data from polaris error.", e);
    throw new ShenyuException("Get data from polaris error: " + e.getMessage(), e);
}
Defensive patterns

Strategy: try-catch

Validate before calling

// before init, verify polaris reachability and config
if (polarisProperties.getNamespace() == null || polarisProperties.getFileGroup() == null) {
    throw new IllegalStateException("polaris namespace/fileGroup must be configured");
}
// optionally ping the config API endpoint before enabling polaris sync

Try / catch

try {
    init.checkDataIdExists(...);
} catch (ShenyuException e) {
    LOG.error("Polaris init failed, check cluster reachability/config: {}", e.getMessage(), e);
    // fall back or retry with backoff
}

Prevention

When it happens

Trigger: Calling dataIdNotExist (during Polaris data-sync init) when the Polaris cluster is unreachable, the namespace/fileGroup is wrong, authentication fails, or the config-file API errors.

Common situations: Misconfigured polaris namespace or file_group in shenyu.admin properties; Polaris server down or network/firewall blocking the port; wrong Polaris address or token after migrating environments.

Related errors


AI-assisted analysis of apache/shenyu@567142e072 (2026-09-12). Data as JSON: /api/errors/1290467ef8b3702b. Report an issue: GitHub.

Appendix: source

Thrown at shenyu-admin-listener/shenyu-admin-listener-polaris/src/main/java/org/apache/shenyu/admin/listener/polaris/PolarisDataChangedInit.java:68

        this.configFileService = configFileService;
    }

    @Override
    protected boolean notExist() {
        return Stream.of(PolarisPathConstants.PLUGIN_DATA_FILE_NAME, PolarisPathConstants.AUTH_DATA_ID_FILE_NAME,
                PolarisPathConstants.META_DATA_FILE_NAME, PolarisPathConstants.PROXY_SELECTOR_FILE_NAME).allMatch(
                this::dataIdNotExist);
    }

    private boolean dataIdNotExist(final String pluginDataId) {
        try {
            return !configFileService.getConfigFile(
                    polarisProperties.getNamespace(),
                    polarisProperties.getFileGroup(),
                    pluginDataId).hasContent();
        } catch (PolarisException e) {
            LOG.error("Get data from polaris error.", e);
            throw new ShenyuException(e.getMessage());
        }
    }
}

View on GitHub (pinned to 567142e072)