stanfordnlp/CoreNLP · error · SsurgeonParseException
RelabelNamedEdge created with no edge name!
Error message
RelabelNamedEdge created with no edge name!
What it means
RelabelNamedEdge changes the GrammaticalRelation of an edge matched and named in the SemgrexPattern. It needs the edge name to identify the edge; a null edgeName makes the operation unusable, so the constructor throws.
Solutions
- Pass the name given to the edge in the SemgrexPattern (edge=...) as the first argument
- Ensure the resource line reads e.g. relabel-named-edge -edge myEdge -reln nsubj
- Confirm the SemgrexPattern contains an edge= clause with that exact name
Example fix
// before
new RelabelNamedEdge(null, UniversalGrammaticalRelations.NOMINAL_SUBJECT);
// after
new RelabelNamedEdge("myEdge", UniversalGrammaticalRelations.NOMINAL_SUBJECT); Defensive patterns
Strategy: validation
Validate before calling
if (edgeName == null || edgeName.isEmpty()) {
throw new IllegalArgumentException("relabel-named-edge requires the named edge from the SemgrexPattern");
}
if (!patternNamesEdges.contains(edgeName)) {
throw new IllegalArgumentException("No edge named " + edgeName + " in the SemgrexPattern");
} Type guard
boolean edgeIsNamed(String name, Set<String> patternEdgeNames) { return name != null && patternEdgeNames.contains(name); } Try / catch
try {
op = new RelabelNamedEdge(edgeName, relation);
} catch (SsurgeonParseException e) {
log.error("Invalid relabel rule: {}", e.getMessage());
throw new RuleSyntaxException(e);
} Prevention
- Ensure the SemgrexPattern contains an edge= clause matching the operation's edge name
- Pair-edit pattern and operation so edge names stay in sync
- Load and dry-run all Ssurgeon rules in a unit test before production use
When it happens
Trigger: new RelabelNamedEdge(null, relation), or an Ssurgeon resource line 'relabel-named-edge' missing the named-edge argument.
Common situations: Malformed Ssurgeon rule file where the edge name token was dropped; programmatic construction where the edge-name string is null because the SemgrexPattern never named an edge; renaming an edge in the pattern without updating the operation.
Related errors
- No governor given for an AddDep
- No relation given for an AddDep
- ReattachNamedEdge created with no edge name!
- ReattachNamedEdge created with both gov and dep missing!
- RelabelNamedEdge created with no relation!
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/bef1849c68d4a1f3.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/RelabelNamedEdge.java:31
* then put it back with the updated relation.
*<br>
* If an edge already exists with the new named relation,
* <i>that</i> edge is deleted permanently. That way, named
* references to the first edge should still work.
*
* @author John Bauer
*
*/
public class RelabelNamedEdge extends SsurgeonEdit {
public static final String LABEL = "relabelNamedEdge";
protected final String edgeName; // Name of the matched edge in the SemgrexPattern
protected final GrammaticalRelation relation; // Type of relation to add between these edges
public RelabelNamedEdge(String edgeName, GrammaticalRelation relation) {
if (edgeName == null) {
throw new SsurgeonParseException("RelabelNamedEdge created with no edge name!");
}
if (relation == null) {
throw new SsurgeonParseException("RelabelNamedEdge created with no relation!");
}
this.edgeName = edgeName;
this.relation = relation;
}
@Override
public String toEditString() {
StringWriter buf = new StringWriter();
buf.write(LABEL); buf.write("\t");
buf.write(Ssurgeon.EDGE_NAME_ARG);buf.write(" ");
buf.write(edgeName); buf.write("\t");
buf.write(Ssurgeon.RELN_ARG);buf.write(" ");View on GitHub (pinned to 1b7edd19c4)