stanfordnlp/CoreNLP · error · RuntimeException
Different chronology: c1=
Error message
Different chronology: c1=${c1}, c2=${c2} What it means
combineMoreGeneralFields merges the more general fields of one Joda-Time Partial into another. It requires both Partials to be built on the exact same Chronology object (e.g. both ISOChronology); mixing chronologies would make field comparisons like isMoreGeneral meaningless, so the library throws a RuntimeException immediately when c1.equals(c2) fails.
Solutions
- Ensure both Partials use the same chronology: rebuild one with p2.withChronology(p1.getChronology()) or construct both with the same DateTimeZone/chronology before calling.
- Normalize to UTC or a single shared DateTimeZone when creating Partials (e.g. ISOChronology.getInstance(DateTimeZone.UTC)).
- If chronologies must differ, convert values field-by-field into a new Partial on the target chronology instead of calling combineMoreGeneralFields directly.
Example fix
// before
Partial combined = JodaTimeUtils.combineMoreGeneralFields(p1, p2, null);
// after
if (!p1.getChronology().equals(p2.getChronology())) {
p2 = p2.withChronology(p1.getChronology());
}
Partial combined = JodaTimeUtils.combineMoreGeneralFields(p1, p2, null); Defensive patterns
Strategy: validation
Validate before calling
if (!p1.getChronology().equals(p2.getChronology())) {
p2 = p2.withChronology(p1.getChronology());
} Prevention
- Create all Partials from one shared Chronology/DateTimeZone constant
- Normalize chronology before temporal operations on third-party Partials
When it happens
Trigger: Calling JodaTimeUtils.combineMoreGeneralFields(p1, p2, mgf) (or its recursive overload) where p1 and p2 were created with different Chronologies, e.g. one from ISOChronology.getInstance() and another from a BuddhistChronology, GJChronology, or a chronology with a different time zone ( Chronologies with different zones are not equal).
Common situations: Mixing Partial objects parsed by different code paths that apply custom chronologies or zones; passing a Partial deserialized from an older serialization that restored a different chronology; constructing one Partial with DateTimeUtils default zone changed mid-run.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- Season start month is unknown
- Array must be sorted!
- Can only operate on preterminals
- Cannot find head word of empty span!
- Cannot read from null object!
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/63a59da13dda7354.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/time/JodaTimeUtils.java:447
}
// PeriodType.forFields(new DurationFieldType[]{dType});
// return new Period(df.getUnitMillis(), PeriodType.forFields(new DurationFieldType[]{dType}));
}
}
return null;
}
public static Partial combineMoreGeneralFields(Partial p1, Partial p2) {
return combineMoreGeneralFields(p1, p2, null);
}
// Combines more general fields from p2 to p1
public static Partial combineMoreGeneralFields(Partial p1, Partial p2, DateTimeFieldType mgf) {
Partial p = p1;
Chronology c1 = p1.getChronology();
Chronology c2 = p2.getChronology();
if (!c1.equals(c2)) {
throw new RuntimeException("Different chronology: c1=" + c1 + ", c2=" + c2);
}
DateTimeFieldType p1MostGeneralField = null;
if (p1.size() > 0) {
p1MostGeneralField = p1.getFieldType(0); // Assume fields ordered from most general to least....
}
if (mgf == null || (p1MostGeneralField != null && isMoreGeneral(p1MostGeneralField, mgf, c1))) {
mgf = p1MostGeneralField;
}
for (int i = 0; i < p2.size(); i++) {
DateTimeFieldType fieldType = p2.getFieldType(i);
if (fieldType == DateTimeFieldType.year()) {
if (p.isSupported(DateTimeFieldType.yearOfCentury())) {
if (!p.isSupported(DateTimeFieldType.centuryOfEra())) {
int yoc = p.get(DateTimeFieldType.yearOfCentury());
int refYear = p2.getValue(i);
int century = refYear / 100;
int y2 = yoc + century*100;
// TODO: Figure out which way to goView on GitHub (pinned to 1b7edd19c4)