stanfordnlp/CoreNLP · error · SsurgeonParseException
ReattachNamedEdge created with no edge name!
Error message
ReattachNamedEdge created with no edge name!
What it means
ReattachNamedEdge reattaches an edge that was matched and named in the SemgrexPattern to a new governor and/or dependent. It requires the name of that matched edge; if the edgeName argument is null it cannot know which edge to operate on and throws immediately in the constructor.
Solutions
- Pass the name of the edge as it is named in the SemgrexPattern (the edge: marker name) as the first argument
- Check the Ssurgeon resource line: ensure the reattach-named-edge operation lists the named edge argument before gov/dep
- Verify the corresponding SemgrexPattern actually names an edge with that name (edge= clause)
Example fix
// before
new ReattachNamedEdge(null, "gov", "dep");
// after
new ReattachNamedEdge("myEdge", "gov", "dep"); // 'myEdge' matches edge= in the SemgrexPattern Defensive patterns
Strategy: validation
Validate before calling
if (edgeName == null || edgeName.isEmpty()) {
throw new IllegalArgumentException("reattach-named-edge requires the name of an edge matched in the SemgrexPattern");
} Type guard
boolean hasEdgeName(String name) { return name != null && !name.isEmpty(); } Try / catch
try {
op = new ReattachNamedEdge(edgeName, gov, dep);
} catch (SsurgeonParseException e) {
log.error("Bad Ssurgeon rule: {}", e.getMessage());
throw new RuleSyntaxException(e);
} Prevention
- Name edges explicitly in the SemgrexPattern with edge= and reuse that exact name
- Validate Ssurgeon resource files at load time before running them
- Keep gov/dep/edge arguments on one well-formed line per operation
When it happens
Trigger: Calling new ReattachNamedEdge(null, gov, dep) directly, or an Ssurgeon resource line 'reattach-named-edge' whose first argument (the named edge) is missing or empty.
Common situations: Hand-editing an Ssurgeon rule file and deleting the edge name token; building the operation programmatically where the edge name variable was never assigned; a malformed resource line parsed with a missing field.
Related errors
- No governor given for an AddDep
- No relation given for an AddDep
- ReattachNamedEdge created with both gov and dep missing!
- RelabelNamedEdge created with no edge name!
- RelabelNamedEdge created with no relation!
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/060f063c4c4844ba.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/ReattachNamedEdge.java:29
* Given a named edge, reconnect that edge elsewhere in the graph, changing either the gov and/or dep.
*<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 ReattachNamedEdge extends SsurgeonEdit {
public static final String LABEL = "reattachNamedEdge";
protected final String edgeName; // Name of the matched edge in the SemgrexPattern
protected final String govNodeName; // Where to put the new gov. If null, will not edit
protected final String depNodeName; // Where to put the new dep. If null, will not edit
public ReattachNamedEdge(String edgeName, String gov, String dep) {
if (edgeName == null) {
throw new SsurgeonParseException("ReattachNamedEdge created with no edge name!");
}
if (gov == null && dep == null) {
throw new SsurgeonParseException("ReattachNamedEdge created with both gov and dep missing!");
}
this.edgeName = edgeName;
this.govNodeName = gov;
this.depNodeName = dep;
}
@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);
View on GitHub (pinned to 1b7edd19c4)