apache/shenyu · error · ShenyuException
key is null or invalid, you should checkout property of
Error message
key is null or invalid, you should checkout property of
What it means
ShenyuClientConfig wraps its client map so that any get() with a null key or a key that has no configured ClientPropertiesConfig throws a ShenyuException instead of returning null. This fails fast when client code asks for a client-type section (e.g. 'springMvc', 'dubbo') that was never configured under shenyu.client.
Solutions
- Add the shenyu.client.<clientType> section (with port, contextPath, appName, isSynchronous etc.) to your configuration
- Check spelling of the client type key passed to get()
- Confirm the properties file actually loaded (profile/paths)
- Compare against the starter's documented required properties
Example fix
// before
shenyu:
register:
registerType: http
# no shenyu.client section -> get("springMvc") throws
// after
shenyu:
client:
springMvc:
port: 8189
contextPath: /springboot
appName: springboot-test Defensive patterns
Strategy: validation
Validate before calling
ClientPropertiesConfig cfg = shenyuClientConfig.getClient().get(clientType); // throws if absent; pre-check with: boolean ok = shenyuClientConfig.getClient().containsKey(clientType);
Type guard
boolean hasClient(String type) { return type != null && shenyuClientConfig.getClient().containsKey(type); } Try / catch
try { config.getClient().get(type); } catch (ShenyuException e) { throw new IllegalStateException("add shenyu.client." + type + " properties", e); } Prevention
- Add the full shenyu.client.<type> block for every client starter you use
- Use containsKey/getRaw before programmatic access
- Double-check YAML nesting and key spelling
When it happens
Trigger: Calling get("someType") on the ShenyuClientConfig client map where the property shenyu.client.<type>.* (appName, contextPath, etc.) is absent, or a null/misspelled client type is passed.
Common situations: Missing shenyu.client block in application.yml for the annotation/SDK in use; typo in the client type key; using a client starter without adding its required config properties; YAML indentation mistakes nesting config under the wrong key.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- client register param must config the appName or contextPath
- The configuration shenyu.discovery.serverList in xml/yml…
- accessToken is null
- Acquire Timeout value must be positive
- can not find port automatically !
AI-assisted analysis of apache/shenyu@567142e072 (2026-09-12).
Data as JSON: /api/errors/ad35b6400bfec01c.
Report an issue: GitHub.
Appendix: source
Thrown at shenyu-register-center/shenyu-register-common/src/main/java/org/apache/shenyu/register/common/config/ShenyuClientConfig.java:36
package org.apache.shenyu.register.common.config;
import org.apache.shenyu.common.exception.ShenyuException;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
* The type Shenyu client config.
*/
public final class ShenyuClientConfig {
private Map<String, ClientPropertiesConfig> client = new HashMap<>() {
@Override
public ClientPropertiesConfig get(final Object key) {
ClientPropertiesConfig config = super.get(key);
if (Objects.isNull(key) || Objects.isNull(config)) {
throw new ShenyuException("key is null or invalid, you should checkout property of " + key);
}
return config;
}
};
private String namespace;
/**
* Gets client.
*
* @return the client
*/
public Map<String, ClientPropertiesConfig> getClient() {
return client;
}
/**
* Sets client.View on GitHub (pinned to 567142e072)