stanfordnlp/CoreNLP · error · RuntimeException
Error on line
Error message
Error on line
What it means
readDeps wraps each line's parsing in a try block; if anything fails while parsing a dependency line (bad number format, unknown fields, malformed indices) the BufferedReader is closed and the original exception is rethrown wrapped in a RuntimeException prefixed with 'Error on line <N>' so the user can locate the offending input line.
Solutions
- Inspect the reported line number and fix that line to match the expected 'rel gov child' format.
- Strip headers/blank lines and verify the delimiter (tab vs. whitespace) matches the reader's expectation.
- Regenerate the dependency file from the parser, ensuring the run completed successfully.
Example fix
// before (input line) nsubj the-dog-1 runs-2 // after nsubj 1 2
Defensive patterns
Strategy: validation
Validate before calling
try (Stream<String> lines = Files.lines(path)) { IntStream.range(1, (int) lines.count()+1).forEach(i -> assertValidDepLine(lineAt(i))); } Try / catch
try { scoring = new DependencyScoring(file, ...); } catch (RuntimeException e) { System.err.println(e.getMessage()); /* message names the offending line */ } Prevention
- Validate input file line format (3 tab-separated fields) before scoring
- Strip headers and blank lines
- Ensure parser output completed and was not truncated
When it happens
Trigger: Any malformed line in the dependency input file: missing tabs/columns, non-numeric indices, empty relation fields, or an exception thrown by the grel lookup — encountered while constructing the DependencyScoring.
Common situations: Files with different column conventions (CoNLL vs. simple 3-column format), trailing blank or header lines, truncated output from a crashed parser, Windows line endings or invisible characters breaking the split.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- Invalid number of fields, should be >=1 and <= 31
- Found a non-empty line in a tsurgeon section after reading…
- Unknown minimizer
- Unknown clique: " + clique
- Bad number put into wordToNumber. Word is: \"" + input +…
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/7cb63d5039512159.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/trees/DependencyScoring.java:232
grel = EnglishGrammaticalRelations.getConj(conj);
}
if (grel == null) {
throw new RuntimeException("Unknown grammatical relation '" + depName+"'");
}
//Word govWord = new Word(govName.substring(0, govDash));
IndexedWord govWord = new IndexedWord();
govWord.setValue(normalizeNumbers(govName));
govWord.setWord(govWord.value());
//Word childWord = new Word(childName.substring(0, childDash));
IndexedWord childWord = new IndexedWord();
childWord.setValue(normalizeNumbers(childName));
childWord.setWord(childWord.value());
TypedDependency dep = new TypedDependencyStringEquality(grel, govWord, childWord);
deps.add(dep);
} catch (Exception e) {
breader.close();
throw new RuntimeException("Error on line "+breader.getLineNumber()+":\n\n"+e);
}
}
if (deps.size() != 0) {
readDeps.add(deps);
}
//log.info("last: "+readDeps.get(readDeps.size()-1));
breader.close();
return readDeps;
}
/**
* Score system typed dependencies
*
* @param system
* @return a triple consisting of (labeled attachment, unlabeled attachment,
* label accuracy)
*/View on GitHub (pinned to 1b7edd19c4)