stanfordnlp/CoreNLP · error · SsurgeonParseException
Cannot make a DeleteGraphFromNode out of " +…
Error message
Cannot make a DeleteGraphFromNode out of " + argsBox.nodes.size() + " nodes
What it means
DeleteGraphFromNode removes the graph rooted at exactly one named node, so parseEditLine enforces that argsBox.nodes contains exactly 1 entry (from -node flags). Otherwise SsurgeonParseException('Cannot make a DeleteGraphFromNode out of N nodes') is thrown.
Solutions
- Provide exactly one -node <name> flag on the deletegraphfromnode line.
- Remove extra -node flags; additional nodes must be handled by separate edit lines.
- If you meant to delete from multiple roots, split into multiple deletegraphfromnode edits in the rule.
Example fix
// before deletegraphfromnode -node a -node b // after deletegraphfromnode -node a deletegraphfromnode -node b
Defensive patterns
Strategy: validation
Validate before calling
int count = countFlagOccurrences(line, "-node");
if (line.startsWith("deletegraphfromnode") && count != 1)
throw new IllegalArgumentException("deletegraphfromnode needs exactly one -node, got " + count); Try / catch
try { parseEditLine(line, attrs, lang); } catch (SsurgeonParseException e) { if (e.getMessage().startsWith("Cannot make a DeleteGraphFromNode")) log.error("Fix -node count in: " + line); } Prevention
- One -node flag per deletegraphfromnode edit
- Split multi-node deletions into separate edits
- Lint -node flag counts per operation type
When it happens
Trigger: A 'deletegraphfromnode' edit line with zero -node flags or more than one -node flag (nodes.size() != 1).
Common situations: Reusing a multi-node arg list from a MergeNodes rule; forgetting the -node flag entirely; a paste-in that kept two -node flags from different rules.
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 DeleteLeaf out of " + argsBox.nodes.size() +…
- Cannot make a Lemmatize out of " + argsBox.nodes.size() + "…
- Cannot make an EditNode 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/4a02a852863e64d7.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/Ssurgeon.java:631
if (command.equalsIgnoreCase(AddDep.LABEL)) {
if (argsBox.reln == null) {
throw new SsurgeonParseException("Relation not specified for AddDep");
}
GrammaticalRelation reln = GrammaticalRelation.valueOf(language, argsBox.reln);
return new AddDep(argsBox.govNodeName, reln, argsBox.annotations, argsBox.position);
} else if (command.equalsIgnoreCase(AddNode.LABEL)) {
return AddNode.createAddNode(argsBox.nodeString, argsBox.name);
} else if (command.equalsIgnoreCase(AddEdge.LABEL)) {
if (argsBox.reln == null) {
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)) {View on GitHub (pinned to 1b7edd19c4)