{"record":{"id":"ad35b6400bfec01c","repo":"apache/shenyu","slug":"key-is-null-or-invalid-you-should-checkout-property-of","errorCode":null,"errorMessage":"key is null or invalid, you should checkout property of ","messagePattern":"key is null or invalid, you should checkout property of ","errorType":"validation","errorClass":"ShenyuException","httpStatus":null,"severity":"error","filePath":"shenyu-register-center/shenyu-register-common/src/main/java/org/apache/shenyu/register/common/config/ShenyuClientConfig.java","lineNumber":36,"sourceCode":"package org.apache.shenyu.register.common.config;\n\nimport org.apache.shenyu.common.exception.ShenyuException;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Objects;\n\n/**\n * The type Shenyu client config.\n */\npublic final class ShenyuClientConfig {\n\n    private Map<String, ClientPropertiesConfig> client = new HashMap<>() {\n        @Override\n        public ClientPropertiesConfig get(final Object key) {\n            ClientPropertiesConfig config = super.get(key);\n            if (Objects.isNull(key) || Objects.isNull(config)) {\n                throw new ShenyuException(\"key is null or invalid, you should checkout property of \" + key);\n            }\n            return config;\n        }\n    };\n    \n    private String namespace;\n    \n    /**\n     * Gets client.\n     *\n     * @return the client\n     */\n    public Map<String, ClientPropertiesConfig> getClient() {\n        return client;\n    }\n    \n    /**\n     * Sets client.","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/apache/shenyu/blob/567142e07261b3e615ae8850b30f4421f455cc5d/shenyu-register-center/shenyu-register-common/src/main/java/org/apache/shenyu/register/common/config/ShenyuClientConfig.java#L18-L54","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nshenyu:\n  register:\n    registerType: http\n# no shenyu.client section -> get(\"springMvc\") throws\n// after\nshenyu:\n  client:\n    springMvc:\n      port: 8189\n      contextPath: /springboot\n      appName: springboot-test","handlingStrategy":"validation","validationCode":"ClientPropertiesConfig cfg = shenyuClientConfig.getClient().get(clientType); // throws if absent; pre-check with: boolean ok = shenyuClientConfig.getClient().containsKey(clientType);","typeGuard":"boolean hasClient(String type) { return type != null && shenyuClientConfig.getClient().containsKey(type); }","tryCatchPattern":"try { config.getClient().get(type); } catch (ShenyuException e) { throw new IllegalStateException(\"add shenyu.client.\" + type + \" properties\", e); }","preventionTips":["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"],"tags":["config","client","validation"],"backgroundTag":"missing-required-config-field","analyzedSha":"567142e07261b3e615ae8850b30f4421f455cc5d","analyzedAt":"2026-09-12T10:08:21.293Z","contentChangedAt":"2026-09-12T10:08:21.293Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}