stanfordnlp/CoreNLP · error · SsurgeonParseException
ReattachNamedEdge created with both gov and dep missing!
Error message
ReattachNamedEdge created with both gov and dep missing!
What it means
ReattachNamedEdge must be given at least one of the new governor or the new dependent node names; if both are null the operation would reattach the edge to exactly where it already is, which is a no-op, so the constructor rejects it.
Solutions
- Supply the name of the matched node to use as the new governor (-gov) or new dependent (-dep)
- If you only meant to change the relation, use a relabel-named-edge operation instead
- Check the resource line so at least one of gov/dep arguments is present
Example fix
// before
new ReattachNamedEdge("myEdge", null, null);
// after
new ReattachNamedEdge("myEdge", "newGov", null); Defensive patterns
Strategy: validation
Validate before calling
if (gov == null && dep == null) {
throw new IllegalArgumentException("reattach-named-edge needs at least one of -gov or -dep");
} Type guard
boolean hasAtLeastOneTarget(String gov, String dep) { return gov != null || dep != null; } Try / catch
try {
op = new ReattachNamedEdge(edgeName, gov, dep);
} catch (SsurgeonParseException e) {
log.error("ReattachNamedEdge rule incomplete: {}", e.getMessage());
throw new RuleSyntaxException(e);
} Prevention
- If you only want to change the relation, use relabel-named-edge, not reattach-named-edge
- Lint Ssurgeon rule files to require at least one of -gov/-dep on reattach operations
- Keep rule edits in version control so dropped arguments are visible in diffs
When it happens
Trigger: new ReattachNamedEdge(edgeName, null, null), or an Ssurgeon resource 'reattach-named-edge' line supplying neither a -gov nor a -dep argument.
Common situations: Deleting the -gov or -dep token from a rule while editing it and accidentally deleting both; a rule generator emitting empty arguments; copy-paste from a relabel rule that takes neither gov nor dep.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- No governor given for an AddDep
- No relation given for an AddDep
- ReattachNamedEdge created with no edge name!
- 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/bb157d2097b03d93.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/ReattachNamedEdge.java:32
* <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);
if (govNodeName != null) {
buf.write("\t");
buf.write(Ssurgeon.GOV_NODENAME_ARG);buf.write(" ");View on GitHub (pinned to 1b7edd19c4)