apache/shenyu · error · ShenyuException
shenyu.register.serverLists formatter is not incorrect.
Error message
shenyu.register.serverLists formatter is not incorrect.
What it means
At ConsulInstanceRegisterRepository.init this ShenyuException is a startup validation guard: the 'shenyu.register.serverLists' property must be a single 'host:port' address, but after splitting on ':' the result does not have exactly 2 parts (e.g. missing port, extra colon, or a comma-separated multi-address list, which this simple parser does not support). It fires while building the ConsulClient during repository initialization (invoked from init of the register config), aborting gateway registration setup because the configured Consul address is malformed.
Solutions
- Set serverLists to exactly host:port without scheme, e.g. 127.0.0.1:8500
- Remove any http:// or https:// prefix from the value
- Provide a single address, not a comma-separated list
- Check the module README for the expected format in your version
Example fix
// before
shenyu:
register:
serverLists: http://localhost:8500
// after
shenyu:
register:
serverLists: localhost:8500 Defensive patterns
Strategy: validation
Validate before calling
String[] a = serverList.split(":"); if (a.length != 2 || a[0].isBlank() || a[1].isBlank()) throw new IllegalArgumentException("serverLists must be host:port without scheme"); Try / catch
try { repository.init(); } catch (ShenyuException e) { log.error("bad serverLists format, expected host:port", e); } Prevention
- Never include http:// in consul serverLists
- Provide exactly one host:port pair
- Add a startup format check before building ConsulClient
When it happens
Trigger: serverLists configured without a port, with multiple colons (e.g. including a scheme like http://host:port), or a comma-separated multi-address list where one entry does not parse as host:port.
Common situations: Copying the consul URL with the http:// scheme (the extra ':' yields >2 parts); forgetting the port (0 parts after split beyond host); supplying several consul nodes in serverLists although this module expects a single host:port.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- shenyu.register.serverLists can not be null.
- sync.consul.url formatter is not incorrect.
- dynamic: result.getMessage() from…
- registry_id is already exist
- registry is not exist
AI-assisted analysis of apache/shenyu@567142e072 (2026-09-12).
Data as JSON: /api/errors/222af3965a27aa5b.
Report an issue: GitHub.
Appendix: source
Thrown at shenyu-registry/shenyu-registry-consul/src/main/java/org/apache/shenyu/registry/consul/ConsulInstanceRegisterRepository.java:109
private final Set<String> watchSelectKeySet = ConcurrentHashMap.newKeySet();
@Override
public void init(final RegisterConfig config) {
final Properties props = config.getProps();
this.checkTtl = props.getProperty("checkTtl", "5");
this.token = props.getProperty("token", "");
this.waitTime = props.getProperty("waitTime", "30");
this.watchDelay = props.getProperty("watchDelay", "5");
this.tags = props.getProperty("tags");
final String serverList = config.getServerLists();
if (StringUtils.isBlank(serverList)) {
throw new ShenyuException("shenyu.register.serverLists can not be null.");
}
final String[] addresses = serverList.split(":");
if (addresses.length != 2) {
throw new ShenyuException("shenyu.register.serverLists formatter is not incorrect.");
}
consulClient = new ConsulClient(addresses[0], Integer.parseInt(addresses[1]));
this.ttlScheduler = new TtlScheduler(Integer.parseInt(checkTtl), consulClient);
Runtime.getRuntime().addShutdownHook(new Thread(this::close));
}
@Override
public void persistInstance(final InstanceEntity instance) {
String instanceNodeName = buildInstanceNodeName(instance);
this.newService = new NewService();
newService.setName(instance.getAppName());
newService.setId(String.join("-", instance.getAppName(), instanceNodeName));
newService.setAddress(instance.getHost());
newService.setPort(instance.getPort());
newService.setCheck(createCheck());
if (StringUtils.isNotEmpty(tags)) {
newService.setTags(new ArrayList<>(Arrays.asList(tags.split(","))));
}View on GitHub (pinned to 567142e072)