stanfordnlp/CoreNLP · error · SsurgeonParseException
Cannot make an EditNode with no nodeName
Error message
Cannot make an EditNode with no nodeName
What it means
EditNode edits an existing matched node, so it must know which node to edit; constructing it with a null nodeName throws SsurgeonParseException immediately. The constructor also rejects edits that change nothing and delegates attribute validation to AddDep.checkIllegalAttributes.
Solutions
- Provide the name of a node from the semgrex match pattern as nodeName.
- Ensure the -node argument is present in the editnode instruction.
- Validate that the referenced node name actually appears in the preceding semgrex pattern before constructing the operation.
Example fix
// before String node = null; // -node argument missing in rule new EditNode(node, attrs, null, List.of(), List.of()); // after String node = "verb"; // name of a node matched by the semgrex pattern new EditNode(node, attrs, null, List.of(), List.of());
Defensive patterns
Strategy: validation
Validate before calling
// Java
if (nodeName == null || nodeName.isBlank()) {
throw new IllegalArgumentException("editnode requires a -node argument naming a matched node");
} Type guard
// Java
static boolean hasNodeName(String nodeName) {
return nodeName != null && !nodeName.isBlank();
} Try / catch
// Java
try {
EditNode op = new EditNode(nodeName, attrs, morpho, removedAttrs, removedMorpho);
} catch (SsurgeonParseException e) {
log.severe("Invalid editnode rule: " + e.getMessage());
} Prevention
- Verify the -node argument exists in every editnode line of .ssurgeon files.
- Check that nodeName appears in the preceding semgrex pattern.
When it happens
Trigger: new EditNode(null, attrs, null, [], []) — typically when the nodeName string was parsed from a rule field that is missing or empty, or generated code passes a null variable.
Common situations: Malformed editnode lines in .ssurgeon files where the -node argument is omitted; scripting tools that build EditNode from optional match-group names that failed to match.
Related errors
- Cannot make a Lemmatize with no nodeName
- Cannot combine MWT out of only
- Cannot make an EditNode with no updated attributes, removed…
- Cannot manually change a document ID. If you need an…
- Cannot manually change the sentence index. If you need an…
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/3285c31872da7f0c.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/EditNode.java:34
import edu.stanford.nlp.trees.ud.CoNLLUFeatures;
/**
* Edit an existing node to have new attributes.
*
* @author John Bauer
*/
public class EditNode extends SsurgeonEdit {
public static final String LABEL = "editNode";
final String nodeName;
final List<String> removedAttributes;
final List<String> removedMorpho;
final Map<String, String> attributes;
final Map<String, String> updateMorphoFeatures;
public EditNode(String nodeName, Map<String, String> attributes, String updateMorphoFeatures, List<String> removedAttributes, List<String> removedMorpho) {
if (nodeName == null) {
throw new SsurgeonParseException("Cannot make an EditNode with no nodeName");
}
if (attributes.size() == 0 && updateMorphoFeatures == null && removedAttributes.size() == 0 && removedMorpho.size() == 0) {
throw new SsurgeonParseException("Cannot make an EditNode with no updated attributes, removed attributes, or updated/removed morphological features");
}
AddDep.checkIllegalAttributes(attributes);
this.nodeName = nodeName;
this.attributes = new TreeMap<>(attributes);
if (updateMorphoFeatures != null) {
this.updateMorphoFeatures = new CoNLLUFeatures(updateMorphoFeatures);
} else {
this.updateMorphoFeatures = Collections.emptyMap();
}
this.removedAttributes = new ArrayList<>(removedAttributes);
for (String attr : removedAttributes) {
if (AnnotationLookup.toCoreKey(attr) == null) {
throw new SsurgeonParseException("Unknown attribute |" + attr + "| when building an EditNode operation");
}
}View on GitHub (pinned to 1b7edd19c4)