stanfordnlp/CoreNLP · error · SsurgeonParseException
Could not find match name for " + elt
Error message
Could not find match name for " + elt
What it means
While parsing the <wordlist> test element in ssurgeon XML, the parser reads the match name from the element's text content. Because getEltText returns empty string rather than null for empty elements, the null check is a defensive guard; a truly missing/empty match name produces this SsurgeonParseException indicating the WordlistTest has no node name to match.
Solutions
- Add the match name as the text content of the wordlist element
- Ensure the name matches a node captured by the pattern's semgrex query
- Read the chained cause to identify the offending element in the XML
Example fix
// before (empty wordlist element) <wordlist id="wl1" type="..." resourceID="..." /> // after <wordlist id="wl1" type="..." resourceID="...">verb</wordlist>
Defensive patterns
Strategy: validation
Validate before calling
// ensure every wordlist element has text content before parsing
org.w3c.dom.NodeList wls = doc.getElementsByTagName("wordlist");
for (int i = 0; i < wls.getLength(); i++) {
String text = wls.item(i).getTextContent();
if (text == null || text.trim().isEmpty())
throw new IllegalStateException("wordlist missing match name");
} Try / catch
try {
List<SsurgeonPattern> pats = ssurgeon.readFromDocument(doc);
} catch (SsurgeonParseException e) {
log.severe("WordlistTest parse failed: " + e.getCause());
} Prevention
- Always give wordlist elements a text body naming a matched node
- Self-check generated XML for empty text nodes before loading
- Keep node names in wordlist tests aligned with the semgrex pattern captures
When it happens
Trigger: An ssurgeon XML <wordlist> element with no text content (empty body) so no node name is available for the WordlistTest.
Common situations: Hand-edited or generated ssurgeon XML where the inner text (the semgrex node name) was deleted or the element was written self-closing.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- XML failure while reading string
- XML failure while reading " + file
- Error configuring XML parser
- org.xml.sax.SAXException
- Quotes size and gold size don't match!
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/df3fa41ebdc2244b.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/Ssurgeon.java:946
return andPred;
}
break;
case SsurgeonPattern.PREDICATE_OR_TAG:
SsurgOrPred orPred = new SsurgOrPred();
for (Element childElt : getChildElements(elt)) {
SsurgPred childPred = assemblePredFromXML(childElt);
orPred.add(childPred);
return orPred;
}
break;
case SsurgeonPattern.PRED_WORDLIST_TEST_TAG:
String id = elt.getAttribute(SsurgeonPattern.PRED_ID_ATTR);
String resourceID = elt.getAttribute("resourceID");
String typeStr = elt.getAttribute("type");
String matchName = getEltText(elt).trim(); // node name to match on
if (matchName == null) {
throw new SsurgeonParseException("Could not find match name for " + elt);
}
if (id == null) {
throw new SsurgeonParseException("No ID attribute for element = " + elt);
}
return new WordlistTest(id, resourceID, typeStr, matchName);
}
// Not a valid node, error out!
throw new SsurgeonParseException("Invalid node encountered during Ssurgeon predicate processing, node name="+eltName);
}
/**
* Reads in the test file and prints readable to string (for debugging).
* Input file consists of semantic graphs, in compact form.
*/
public void testRead(File tgtDirPath) throws Exception {View on GitHub (pinned to 1b7edd19c4)