stanfordnlp/CoreNLP · error · java.io.IOException
Number of pointers != size of short form
Error message
Number of pointers != size of short form
What it means
Alignment.loadPointers reads a whitespace-separated line of integer pointers and validates that its length equals shortForm.length before parsing. If the counts disagree, the file's pointer row does not correspond to the short form, and an IOException with this message is thrown rather than proceeding with a misaligned array.
Solutions
- Check that the shortform file and pointers file are a matched pair from the same dataset release.
- Re-download or regenerate the alignment data files to fix truncation/corruption.
- Count the entries: the pointer line must contain exactly one integer per shortForm element; fix the data file accordingly.
Defensive patterns
Strategy: validation
Validate before calling
// Pre-validate data file consistency
String[] lines = Files.readAllLines(Paths.get(pointersFile)).toArray(new String[0]);
int shortFormLen = shortForm.length;
int pointerCount = lines[0].trim().split("\\s+").length;
if (pointerCount != shortFormLen) throw new IllegalStateException("Mismatched alignment files"); Try / catch
try {
Alignment a = new Alignment(reader, shortForm);
} catch (IOException e) {
log.warning("Alignment data mismatch/corruption: " + e.getMessage());
a = null; // fall back or abort
} Prevention
- Keep shortform and pointer files from the same dataset release together.
- Checksum data files after download and before use.
- Never hand-edit alignment data without revalidating counts.
When it happens
Trigger: Loading a pascal alignment/shortform data file whose pointer-count line has fewer or more integers than the short form previously read (truncated file, wrong file pairing, hand-edited data).
Common situations: Passing mismatched file pair to Alignment (shortForm from one file, pointers from another), corrupted download of the alignment data, or editing the data file and dropping entries.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- : Entry has multiple types for : . Taking type to be
- argsToProperties could not read properties file: " + file
- Attempt to make ObjectBank with empty file list
- Attempt to open file with null name
- Bad line:
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/31c99ad85a9d141f.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/ie/pascal/Alignment.java:53
public Alignment(BufferedReader reader) throws IOException {
String line;
line = reader.readLine();
if (line == null) {
throw new IOException();
}
longForm = line.toCharArray();
line = reader.readLine();
if (line == null) {
throw new IOException();
}
shortForm = line.toCharArray();
line = reader.readLine();
if (line == null) {
throw new IOException();
}
String[] pstrings = line.split("\\s+");
if (pstrings.length != shortForm.length) {
throw new IOException("Number of pointers != size of short form");
}
pointers = new int[pstrings.length];
for (int i = 0; i < pointers.length; ++i) {
pointers[i] = Integer.parseInt(pstrings[i]);
}
}
public void print() {
System.out.println(toString());
}
@Override
public String toString() {
return toString("");
}
private static final char[] spaces = " ".toCharArray();
View on GitHub (pinned to 1b7edd19c4)