stanfordnlp/CoreNLP · error · SsurgeonParseException
Unknown attribute | | when building an EditNode operation
Error message
Unknown attribute |${attr}| when building an EditNode operation What it means
Every name listed in removedAttributes must map to a known CoreAnnotation key via AnnotationLookup.toCoreKey. If a name is unknown, the EditNode constructor throws SsurgeonParseException naming the offending attribute, preventing silent no-op removals of unrecognized keys.
Solutions
- Fix the attribute name to one AnnotationLookup.toCoreKey recognizes (e.g. "pos", "lemma", "word", "feats", "ner").
- Pre-validate each removal name with AnnotationLookup.toCoreKey(attr) != null before constructing EditNode.
- Check the Stanford CoreNLP AnnotationLookup key table for the correct spelling for your version.
Example fix
// before
new EditNode("node", attrs, null, List.of("postag"), List.of());
// after
new EditNode("node", attrs, null, List.of("pos"), List.of()); Defensive patterns
Strategy: validation
Validate before calling
// Java
for (String attr : removedAttributes) {
if (AnnotationLookup.toCoreKey(attr) == null) {
throw new IllegalArgumentException("Unknown attribute for removal: " + attr);
}
} Try / catch
// Java
try {
EditNode op = new EditNode(node, attrs, morpho, removedAttrs, removedMorpho);
} catch (SsurgeonParseException e) {
log.severe("Bad removeAttributes entry: " + e.getMessage());
} Prevention
- Use exact AnnotationLookup key spellings (pos, lemma, word, feats, ner) in -removeAttributes.
- Pre-validate removal names against AnnotationLookup.toCoreKey when generating rules.
When it happens
Trigger: new EditNode("node", attrs, null, List.of("feats3"), List.of()) where "feats3" (or any misspelled key like "PoS", "postag") has no CoreAnnotation mapping; thrown in the constructor loop calling AnnotationLookup.toCoreKey.
Common situations: Typos or legacy field names in -removeAttributes lists in .ssurgeon files; using CoNLL-U column labels that AnnotationLookup does not recognize; version differences where a key was renamed.
Related errors
- Unable to process node attribute keys for Ssurgeon operation
- Unknown position in AddDep operation
- Cannot manually set the index attribute. If you need a…
- Cannot manually change the sentence index. If you need an…
- Cannot manually change a document ID. If you need an…
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/b4d8707d14c6108b.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/EditNode.java:50
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");
}
}
this.removedMorpho = new ArrayList<>(removedMorpho);
}
/**
* Emits a parseable instruction string.
*/
@Override
public String toEditString() {
StringBuilder buf = new StringBuilder();
buf.append(LABEL); buf.append("\t");
buf.append(Ssurgeon.NODENAME_ARG);buf.append(" ");
buf.append(nodeName); buf.append("\t");
for (String key : attributes.keySet()) {
buf.append("-");View on GitHub (pinned to 1b7edd19c4)