stanfordnlp/CoreNLP · error · IllegalStateException
The components of this AverageDataSeries do not have the sam
Error message
The components of this AverageDataSeries do not have the same domains!
What it means
AverageDataSeries.domain() requires all components to report the identical domain (same domain object). It takes components[0]'s domain and throws IllegalStateException if any other component's domain() returns a different reference, because averaging series over different x-points is undefined. Note the comparison uses reference inequality (!=), so components from independently constructed series with equal content may still fail.
Solutions
- Ensure all component series share the same domain object (pass the same domain instance to each series).
- Rebuild/normalize each component's data onto a common domain before averaging.
- If domains are logically equal but distinct objects, pre-merge them into one canonical domain object and assign it to all components.
Example fix
// before
DataSeries d1 = makeDomain(xs);
DataSeries d2 = makeDomain(xs); // equal but distinct object
AverageDataSeries avg = new AverageDataSeries(new DataSeries[]{s1(d1), s2(d2)}); // throws
// after
DataSeries shared = makeDomain(xs);
AverageDataSeries avg = new AverageDataSeries(new DataSeries[]{s1(shared), s2(shared)}); Defensive patterns
Strategy: validation
Validate before calling
Object domain0 = components[0].domain();
for (DataSeries s : components) {
if (s.domain() != domain0) {
throw new IllegalStateException("Components must share the same domain object before averaging");
}
} Try / catch
try {
avg = new AverageDataSeries(components);
} catch (IllegalStateException e) {
DataSeries canonical = components[0].domain();
for (DataSeries s : components) s = rebindDomain(s, canonical); // rebuild on shared domain
avg = new AverageDataSeries(components);
} Prevention
- Construct all component series from one shared domain object.
- Normalize series onto a common domain before combining.
- Remember domain comparison is by reference (==), not content equality.
When it happens
Trigger: Constructing an AverageDataSeries from series whose domain() implementations return different domain objects; domain() is also called from the constructor, so simply building the AverageDataSeries can trigger it.
Common situations: Combining series loaded from different files or produced by different pipelines where each creates its own domain instance, even when the domains logically match.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- New chunk started, prev chunk not ended yet!
- Node cannot be both negated and optional.
- Node cannot be both negated and optional.
- You cannot set capacity to smaller than the current size.
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/a97275c0a0ed067d.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/stats/DataSeries.java:359
public double get(int i) {
double y = 0.0;
for (DataSeries series : components)
y += series.get(i);
return y / components.length;
}
public int size() {
int size = Integer.MAX_VALUE;
for (DataSeries series : components)
size = Math.min(size, series.size());
return size;
}
public DataSeries domain() {
DataSeries domain = components[0].domain(); // could be null
for (DataSeries series : components)
if (series.domain() != domain)
throw new IllegalStateException("The components of this AverageDataSeries do not have the same domains!");
return domain;
}
@Override
public String toString() { return name(); }
}
}
View on GitHub (pinned to 1b7edd19c4)