stanfordnlp/CoreNLP · error · SsurgeonParseException
Cannot make an EditNode out of " + argsBox.nodes.size() + "…
Error message
Cannot make an EditNode out of " + argsBox.nodes.size() + " nodes. Please use exactly one -node
What it means
EditNode modifies exactly one node, so parseEditLine requires argsBox.nodes.size() == 1. Any other count raises SsurgeonParseException('Cannot make an EditNode out of N nodes. Please use exactly one -node').
Solutions
- Use exactly one -node <name> flag on the editnode line.
- Create one editnode edit per target node in the rule's edit list.
- Check flag spelling: -node populates nodes for editnode; verify your value names an existing named node.
Example fix
// before editnode -node a -node b -lemma x // after editnode -node a -lemma x editnode -node b -lemma x
Defensive patterns
Strategy: validation
Validate before calling
int count = countFlagOccurrences(line, "-node");
if (line.startsWith("editnode") && count != 1)
throw new IllegalArgumentException("editnode needs exactly one -node, got " + count); Try / catch
try { parseEditLine(line, attrs, lang); } catch (SsurgeonParseException e) { if (e.getMessage().startsWith("Cannot make an EditNode")) log.error("editnode requires exactly one -node: " + line); } Prevention
- One editnode edit per target node
- Don't confuse -node with -nodes for single-target ops
- Validate rule files at load time
When it happens
Trigger: An 'editnode' line with zero or 2+ -node flags; other flags like -lemma/-pos/-ner don't count — only -node flags populate nodes.
Common situations: Trying to batch-edit several matched nodes in one editnode call; typo of the flag (-nodes is a different box for ops like lemmatize/merge) leaving the node list empty while other flags accumulate.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- Cannot make a DeleteGraphFromNode out of " +…
- Cannot make a DeleteLeaf out of " + argsBox.nodes.size() +…
- Cannot make a Lemmatize out of " + argsBox.nodes.size() + "…
- Cannot make a KillAllIncomingEdges out of " +…
- Cannot make a MergeNodes out of fewer than 2 nodes (got " +…
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/24ba7cdc1025b07c.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/Ssurgeon.java:641
throw new SsurgeonParseException("Relation not specified for AddEdge");
}
GrammaticalRelation reln = GrammaticalRelation.valueOf(language, argsBox.reln);
return new AddEdge(argsBox.govNodeName, argsBox.dep, reln, argsBox.weight);
} else if (command.equalsIgnoreCase(ReattachNamedEdge.LABEL)) {
return new ReattachNamedEdge(argsBox.edge, argsBox.govNodeName, argsBox.dep);
} else if (command.equalsIgnoreCase(DeleteGraphFromNode.LABEL)) {
if (argsBox.nodes.size() != 1) {
throw new SsurgeonParseException("Cannot make a DeleteGraphFromNode out of " + argsBox.nodes.size() + " nodes");
}
return new DeleteGraphFromNode(argsBox.nodes.get(0));
} else if (command.equalsIgnoreCase(DeleteLeaf.LABEL)) {
if (argsBox.nodes.size() != 1) {
throw new SsurgeonParseException("Cannot make a DeleteLeaf out of " + argsBox.nodes.size() + " nodes");
}
return new DeleteLeaf(argsBox.nodes.get(0));
} else if (command.equalsIgnoreCase(EditNode.LABEL)) {
if (argsBox.nodes.size() != 1) {
throw new SsurgeonParseException("Cannot make an EditNode out of " + argsBox.nodes.size() + " nodes. Please use exactly one -node");
}
return new EditNode(argsBox.nodes.get(0), argsBox.annotations, argsBox.updateMorphoFeatures, argsBox.remove, argsBox.removeMorphoFeatures);
} else if (command.equalsIgnoreCase(Lemmatize.LABEL)) {
if (argsBox.nodes.size() != 1) {
throw new SsurgeonParseException("Cannot make a Lemmatize out of " + argsBox.nodes.size() + " nodes. Please use exactly one -node");
}
return new Lemmatize(argsBox.nodes.get(0), language);
} else if (command.equalsIgnoreCase(MergeNodes.LABEL)) {
if (argsBox.nodes.size() < 2) {
throw new SsurgeonParseException("Cannot make a MergeNodes out of fewer than 2 nodes (got " + argsBox.nodes.size() + ")");
}
return new MergeNodes(argsBox.nodes, argsBox.annotations);
} else if (command.equalsIgnoreCase(RelabelNamedEdge.LABEL)) {
if (argsBox.reln == null) {
throw new SsurgeonParseException("Relation not specified for AddEdge");
}
GrammaticalRelation reln = GrammaticalRelation.valueOf(language, argsBox.reln);
return new RelabelNamedEdge(argsBox.edge, reln);View on GitHub (pinned to 1b7edd19c4)