MyCATApache/Mycat-Server · error · RuntimeException
can not find the data node with name
Error message
can not find the data node with name:{dataNode} What it means
Before fetching, SequenceVal resolves the data host config for the sequence's dataNode from MycatConfig. If conf.getDataNodes() has no entry for this.dataNode, it throws a RuntimeException naming the missing data node. This is a configuration-resolution failure, not a runtime DB failure.
Solutions
- Verify the dataNode name in the sequence/table config matches a <dataNode name="..."> entry in schema.xml.
- Fix the typo or add the missing dataNode definition, then restart/reload Mycat.
- Check that the config Mycat loaded at runtime is the file you edited (correct conf directory).
Example fix
// before (schema.xml) <table name="t" dataNode="dnX"/> <!-- dnX not defined --> // after <dataNode name="dn1" dataHost="host1" database="db1"/> <table name="t" dataNode="dn1"/>
Defensive patterns
Strategy: validation
Validate before calling
if (!MycatServer.getInstance().getConfig().getDataNodes().containsKey(dataNode)) {
throw new IllegalArgumentException("dataNode not defined: " + dataNode);
} Try / catch
try { seqVal.fetchSequenceFromDB(); } catch (RuntimeException e) { log.error("missing dataNode for sequence", e); } Prevention
- Validate that table/sequence dataNodes exist in schema.xml at startup
- Reload config consistently after renames
- Keep sequence dataNode references generated from the same config source
When it happens
Trigger: SequenceVal constructed with a dataNode name that is not declared in schema.xml's <dataNode> definitions (typo, dataNode removed, config not reloaded).
Common situations: Sequence configured under a table whose dataNode was renamed; stale Mycat config after editing schema.xml without restart/reload.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- dataNode name is null
- invalid table dataNodes
- invalid param ,connection request db is
- SelfCheck### user all node is empty!
- SelfCheck### users node within the item is empty!
AI-assisted analysis of MyCATApache/Mycat-Server@65f8d8beb7 (2026-09-11).
Data as JSON: /api/errors/11454c1af9c7ce08.
Report an issue: GitHub.
Appendix: source
Thrown at src/main/java/io/mycat/route/sequence/handler/SequenceVal.java:231
con.close();
pstmt.close();
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
LOGGER.error("get sequence:" + this.seqName + " value failure, please check the sequence config");
this.fetching.compareAndSet(true, false);
return null;
}
private DataHostConfig getDBHostConfig() {
MycatConfig conf = MycatServer.getInstance().getConfig();
PhysicalDBNode mysqlDN = conf.getDataNodes().get(this.dataNode);
if (mysqlDN == null) {
throw new RuntimeException("can not find the data node with name:" + this.dataNode);
}
PhysicalDatasource physicalDatasource = mysqlDN.getDbPool().getSource();
return physicalDatasource.getHostConfig();
}
public void sleep(long time) {
try {
Thread.sleep(time);
} catch (InterruptedException e) {
IncrSequenceMySQLHandler.LOGGER
.warn("wait db fetch sequnce err " + e);
}
}
//是否成功返回。
public boolean isSuccessFetched() {
return successFetched;
}
//下一个可用的idView on GitHub (pinned to 65f8d8beb7)