alibaba/canal · error · IllegalArgumentException
at least 1 node required.
Error message
at least 1 node required.
What it means
Error "at least 1 node required." thrown in alibaba/canal.
Source
Thrown at client/src/main/java/com/alibaba/otter/canal/client/impl/SimpleNodeAccessStrategy.java:22
import java.util.ArrayList;
import java.util.List;
import com.alibaba.otter.canal.client.CanalNodeAccessStrategy;
/**
* 简单版本的node访问实现
*
* @author jianghang 2012-10-29 下午08:00:23
* @version 1.0.0
*/
public class SimpleNodeAccessStrategy implements CanalNodeAccessStrategy {
private List<SocketAddress> nodes = new ArrayList<>();
private int index = 0;
public SimpleNodeAccessStrategy(List<? extends SocketAddress> nodes){
if (nodes == null || nodes.size() < 1) {
throw new IllegalArgumentException("at least 1 node required.");
}
this.nodes.addAll(nodes);
}
@Override
public SocketAddress nextNode() {
try {
return nodes.get(index);
} finally {
index = (index + 1) % nodes.size();
}
}
@Override
public SocketAddress currentNode() {
return nodes.get(index);
}
View on GitHub (pinned to 87be50e876)
Solutions
- Provide at least one SocketAddress node when constructing SimpleNodeAccessStrategy.
- Check that the configured canal server address list (canal.server / zk path resolution) is not empty.
When it happens
Trigger: Thrown at client/src/main/java/com/alibaba/otter/canal/client/impl/SimpleNodeAccessStrategy.java:22 when the library encounters an invalid state.
Common situations: Empty node list. Validate configuration at construction time so a zero-node strategy can never be built; reject blank addresses individually.
AI-assisted analysis of alibaba/canal@87be50e876 (2026-08-14).
Data as JSON: /api/errors/25501b52abe90806.
Report an issue: GitHub.