{"record":{"id":"daf86e5284c52a9b","repo":"apache/shenyu","slug":"shenyu-register-into-shenyudiscoveryservice-s-type-find","errorCode":null,"errorMessage":"shenyu register into ShenyuDiscoveryService %s type find error","messagePattern":"shenyu register into ShenyuDiscoveryService (.+?) type find error","errorType":"exception","errorClass":"ShenyuException","httpStatus":null,"severity":"error","filePath":"shenyu-client/shenyu-client-core/src/main/java/org/apache/shenyu/client/core/register/InstanceRegisterListener.java","lineNumber":93,"sourceCode":"        try {\n            if (StringUtils.isBlank(discoveryConfig.getRegisterType()) || StringUtils.equalsIgnoreCase(discoveryConfig.getRegisterType(), \"local\")) {\n                return;\n            }\n            this.discoveryService = ExtensionLoader.getExtensionLoader(ShenyuInstanceRegisterRepository.class).getJoin(discoveryConfig.getRegisterType());\n            discoveryConfig.getProps().put(\"watchPath\", path);\n            discoveryService.init(discoveryConfig);\n            InstanceEntity instance = new InstanceEntity();\n            instance.setStatus(currentInstanceUpstream.getStatus());\n            instance.setWeight(currentInstanceUpstream.getWeight());\n            final URI uri = URI.create(currentInstanceUpstream.getProtocol() + currentInstanceUpstream.getUrl());\n            instance.setPort(uri.getPort());\n            instance.setHost(uri.getHost());\n            instance.setAppName(discoveryConfig.getProps().getProperty(\"name\"));\n            discoveryService.persistInstance(instance);\n            LOGGER.info(\"shenyu register into ShenyuDiscoveryService {} success\", discoveryConfig.getRegisterType());\n        } catch (Exception e) {\n            LOGGER.error(\"shenyu register into ShenyuDiscoveryService  {} type find error\", discoveryConfig.getRegisterType(), e);\n            throw new ShenyuException(String.format(\"shenyu register into ShenyuDiscoveryService %s type find error\", discoveryConfig.getRegisterType()));\n        }\n    }\n\n    @Override\n    public int getOrder() {\n        return HIGHEST_PRECEDENCE;\n    }\n}\n","sourceCodeStart":75,"sourceCodeEnd":102,"githubUrl":"https://github.com/apache/shenyu/blob/567142e07261b3e615ae8850b30f4421f455cc5d/shenyu-client/shenyu-client-core/src/main/java/org/apache/shenyu/client/core/register/InstanceRegisterListener.java#L75-L102","documentation":"InstanceRegisterListener.onApplicationEvent registers the client instance (host/port) into the configured ShenyuDiscoveryService (zookeeper, nacos, etcd...). Any exception thrown by the discovery provider's persistInstance (connection loss, unknown type, provider failure) is caught, logged, and rethrown as a ShenyuException naming the register type.","triggerScenarios":"Application startup (ApplicationReadyEvent) when discoveryService.persistInstance fails: discovery server unreachable, wrong `shenyu.discovery.type` with no matching SPI implementation, invalid registerPath/props (e.g. missing `name`), or auth failure against the registry.","commonSituations":"Registry (zk/nacos/etcd) down or firewalled at dev startup; typo in discovery type so ExtensionLoader returns no implementation; registry credentials wrong; network partition in k8s between client pod and registry.","solutions":["Read the chained cause in the log line `shenyu register into ShenyuDiscoveryService ... type find error` to see the root failure.","Verify the registry address (`shenyu.discovery.serverList`) is reachable (telnet/nc the host:port) and credentials are correct.","Confirm `shenyu.discovery.type` matches an available ShenyuDiscoveryService SPI implementation on the classpath.","Retry startup once the registry is healthy; the registration is idempotent (persistInstance)."],"exampleFix":"# before (type with no provider on classpath)\nshenyu:\n  discovery:\n    type: consul\n# after (match an available SPI, e.g. zookeeper starter present)\nshenyu:\n  discovery:\n    type: zookeeper\n    serverList: localhost:2181","handlingStrategy":"try-catch","validationCode":"// pre-flight: registry reachable?\ntry (Socket s = new Socket()) {\n    s.connect(new InetSocketAddress(host, port), 3000); // throws if registry down\n}","typeGuard":null,"tryCatchPattern":"try {\n    applicationEventPublisher.publishEvent(event);\n} catch (ShenyuException e) {\n    LOGGER.error(\"instance registration failed, will not retry automatically: {}\", e.getMessage(), e);\n    // alert / mark app unhealthy\n}","preventionTips":["Verify registry connectivity (zk/nacos/etcd) before deploying.","Keep the discovery type aligned with the starter on your classpath.","Validate discovery props like `name` in CI config tests."],"tags":["discovery","registry","startup","network"],"backgroundTag":"api-request-failed","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"}