{"record":{"id":"ddfcae39f4eaf839","repo":"apache/shenyu","slug":"clientconfig-must-config-getclientname-properties","errorCode":null,"errorMessage":"clientConfig must config \" + getClientName() + \" properties","messagePattern":"clientConfig must config \" \\+ getClientName\\(\\) \\+ \" properties","errorType":"exception","errorClass":"ShenyuClientIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"shenyu-client/shenyu-client-core/src/main/java/org/apache/shenyu/client/core/client/AbstractContextRefreshedEventListener.java","lineNumber":120,"sourceCode":"\n    private ApplicationContext context;\n\n    /**\n     * multiple namespace support.\n     */\n    private final List<String> namespace;\n\n    /**\n     * Instantiates a new context refreshed event listener.\n     *\n     * @param clientConfig                   the shenyu client config\n     * @param shenyuClientRegisterRepository the shenyuClientRegisterRepository\n     */\n    public AbstractContextRefreshedEventListener(final ShenyuClientConfig clientConfig,\n                                                 final ShenyuClientRegisterRepository shenyuClientRegisterRepository) {\n        ClientPropertiesConfig config = clientConfig.getClient().get(getClientName());\n        if (Objects.isNull(config)) {\n            throw new ShenyuClientIllegalArgumentException(\"clientConfig must config \" + getClientName() + \" properties\");\n        }\n        Properties props = config.getProps();\n        String namespace = clientConfig.getNamespace();\n        if (StringUtils.isBlank(namespace)) {\n            LOG.warn(\"current shenyu.namespace is null, use default namespace: {}\", Constants.SYS_DEFAULT_NAMESPACE_ID);\n            namespace = Constants.SYS_DEFAULT_NAMESPACE_ID;\n        }\n        this.namespace = Lists.newArrayList(StringUtils.split(namespace, Constants.SEPARATOR_CHARS));\n        this.appName = props.getProperty(ShenyuClientConstants.APP_NAME);\n        this.contextPath = Optional.ofNullable(props.getProperty(ShenyuClientConstants.CONTEXT_PATH)).map(UriUtils::repairData).orElse(\"\");\n        if (StringUtils.isBlank(appName) && StringUtils.isBlank(contextPath)) {\n            String errorMsg = \"client register param must config the appName or contextPath\";\n            LOG.error(errorMsg);\n            throw new ShenyuClientIllegalArgumentException(errorMsg);\n        }\n        this.ipAndPort = props.getProperty(ShenyuClientConstants.IP_PORT);\n        this.host = props.getProperty(ShenyuClientConstants.HOST);\n        this.port = props.getProperty(ShenyuClientConstants.PORT);","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/apache/shenyu/blob/567142e07261b3e615ae8850b30f4421f455cc5d/shenyu-client/shenyu-client-core/src/main/java/org/apache/shenyu/client/core/client/AbstractContextRefreshedEventListener.java#L102-L138","documentation":"AbstractContextRefreshedEventListener's constructor requires a ClientPropertiesConfig entry for the current client type (e.g. spring-cloud, dubbo) under shenyu.<clientName>. If clientConfig.getClient().get(getClientName()) returns null it throws ShenyuClientIllegalArgumentException. Your backend service has not configured the mandatory client properties for this Shenyu client module.","triggerScenarios":"Starting a Shenyu client application (Spring MVC/Dubbo/etc. registered via the client starter) without a shenyu.<clientName> properties block (register address/port, contextPath etc.) in application.yml.","commonSituations":"Copy-pasting a bootstrap config from a service using a different client type; upgrading ShenYu where config keys were renamed/nested; leaving the client starter on the classpath after removing its config; YAML indentation placing properties under the wrong key.","solutions":["Add the required shenyu.<clientName> config block (register.address, register.port, props like contextPath/appName) to application.yml","Check YAML indentation — the properties must sit under the exact key getClientName() returns (e.g. shenyu.spring-cloud)","Remove the unused shenyu client starter dependency if the service doesn't use that client type","After upgrading ShenYu, diff your client config against the current docs/example configs"],"exampleFix":"// before (application.yml — missing client block)\nshenyu:\n  register:\n    address: http://localhost:9095\n// after\nshenyu:\n  register:\n    address: http://localhost:9095\n  client:\n    spring-cloud:\n      props:\n        contextPath: /springcloud\n        appName: springcloud\n        port: 8081","handlingStrategy":"validation","validationCode":"// before starting the app, ensure the client config exists\nShenyuClientConfig cfg = /* bound shenyu.* properties */;\nif (cfg.getClient() == null || !cfg.getClient().containsKey(\"spring-cloud\")) {\n    throw new IllegalStateException(\"add shenyu.client.spring-cloud config to application.yml\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    new SpringApplication(App.class).run(args);\n} catch (ShenyuClientIllegalArgumentException e) {\n    log.error(\"Shenyu client config missing: {}\", e.getMessage());\n    // fix yml and restart\n}","preventionTips":["Copy client config from the matching shenyu-examples project for your client type","Re-check client config keys after ShenYu version upgrades","Remove client starters for client types the service does not use"],"tags":["configuration","client","startup","spring"],"backgroundTag":"missing-required-config","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"}