MyCATApache/Mycat-Server · error · IllegalArgumentException
columnValue: Please check if the format satisfied.
Error message
columnValue:{columnValue} Please check if the format satisfied. What it means
PartitionByMonth.calculate() parses the column value as a date to derive a month-based partition. When SimpleDateFormat throws ParseException, this IllegalArgumentException is raised. The value must match the configured dateFormat (default yyyy-MM-dd) for the month partition to be computed.
Solutions
- Set the dateFormat property to match the actual column format exactly.
- Normalize the column value before it reaches the router (application-side reformatting).
- Catch IllegalArgumentException in the query path and reject malformed dates with a clear client error.
Example fix
// before (dateFormat yyyy-MM-dd) INSERT INTO t(id, m) VALUES(1, '01-2024-15'); // after INSERT INTO t(id, m) VALUES(1, '2024-01-15');
Defensive patterns
Strategy: validation
Validate before calling
boolean valid;
try {
new java.text.SimpleDateFormat(dateFormat).parse(columnValue);
valid = true;
} catch (java.text.ParseException e) { valid = false; }
Try / catch
try {
Integer node = partitionByMonth.calculate(columnValue);
} catch (IllegalArgumentException e) {
// malformed month-column value; log value and dateFormat, reject query
} Prevention
- Pin an explicit dateFormat in rule.xml, never rely on defaults
- Use zero-padded yyyy-MM-dd everywhere
- Test calculate() with values from all writer services
When it happens
Trigger: calculate() (also reached via test() and sence1()) receiving a value unparseable by the configured dateFormat: wrong order (dd-MM-yyyy), embedded time when pattern lacks it, empty or malformed strings.
Common situations: Monthly sharding rules where the app writes full timestamps but the rule expects date-only strings; locale-specific formats; values like '20240101' without separators.
Related errors
- columnValue: Please check if the format satisfied.
- columnValue: Please check if the format satisfied.
- columnValue: Please check if the format satisfied.
- columnValue: Please check if the format satisfied.
- columnValue: Please check if the format satisfied.
AI-assisted analysis of MyCATApache/Mycat-Server@65f8d8beb7 (2026-09-11).
Data as JSON: /api/errors/1e20ea1af5c1f388.
Report an issue: GitHub.
Appendix: source
Thrown at src/main/java/io/mycat/route/function/PartitionByMonth.java:133
targetPartition = ((curTime.get(Calendar.YEAR) - beginDate.get(Calendar.YEAR))
* 12 + curTime.get(Calendar.MONTH)
- beginDate.get(Calendar.MONTH));
/**
* For circulatory partition, calculated value of target partition needs to be
* rotated to fit the partition range
*/
if (nPartition > 0) {
targetPartition = reCalculatePartition(targetPartition);
}
// 防止越界的情况
if (targetPartition < 0) {
targetPartition = 0;
}
return targetPartition;
} catch (ParseException e) {
throw new IllegalArgumentException(new StringBuilder().append("columnValue:").append(columnValue)
.append(" Please check if the format satisfied.").toString(), e);
}
}
@Override
public Integer[] calculateRange(String beginValue, String endValue) {
try {
return doCalculateRange(beginValue, endValue, beginDate);
} catch (ParseException e) {
LOGGER.error("error", e);
return new Integer[0];
}
}
private Integer[] doCalculateRange(String beginValue, String endValue, Calendar beginDate) throws ParseException {
int startPartition, endPartition;
Calendar partitionTime = Calendar.getInstance();
SimpleDateFormat format = new SimpleDateFormat(dateFormat);View on GitHub (pinned to 65f8d8beb7)