stanfordnlp/CoreNLP · error · SsurgeonParseException

Cannot make a KillAllIncomingEdges out of " +…

Error message

Cannot make a KillAllIncomingEdges out of " + argsBox.nodes.size() + " nodes

What it means

A kill-all-incoming-edges edit operates on exactly one matched node, deleting every incoming edge to it. parseEditLine throws SsurgeonParseException when the number of -node arguments is not exactly 1.

Solutions

  1. Give exactly one -node:NAME argument naming a node matched by the semgrex pattern
  2. Remove any extra -node arguments if you intended a single target
  3. Apply one kill-all-incoming-edges edit per target node instead of listing several nodes

Example fix

# before
kill-all-incoming-edges -node:dep -node:gov
# after
kill-all-incoming-edges -node:dep
Defensive patterns

Strategy: validation

Validate before calling

boolean validKillIncoming(String line) {
  long n = java.util.Arrays.stream(line.split("\\s+"))
      .filter(t -> t.startsWith("-node:")).count();
  return line.startsWith("kill-all-incoming-edges") && n == 1;
}

Try / catch

try {
  SsurgeonEdit e = Ssurgeon.parseEditLine(line);
} catch (SsurgeonParseException ex) {
  log.warning("kill-all-incoming-edges requires exactly one -node: " + line);
}

Prevention

When it happens

Trigger: Edit line 'kill-all-incoming-edges' with zero -node entries, or mistakenly with multiple -node entries, hits `argsBox.nodes.size() != 1`.

Common situations: Authors reusing a multi-node rule template, or appending an extra -node when combining edits in an ssurgeon file.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10). Data as JSON: /api/errors/d6ce917af9afaf24. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/Ssurgeon.java:670

        }
        return new MergeNodes(argsBox.nodes, argsBox.annotations);
      } else if (command.equalsIgnoreCase(RelabelNamedEdge.LABEL)) {
        if (argsBox.reln == null) {
          throw new SsurgeonParseException("Relation not specified for AddEdge");
        }
        GrammaticalRelation reln = GrammaticalRelation.valueOf(language, argsBox.reln);
        return new RelabelNamedEdge(argsBox.edge, reln);
      } else if (command.equalsIgnoreCase(RemoveEdge.LABEL)) {
        GrammaticalRelation reln = null;
        if (argsBox.reln != null) {
          reln = GrammaticalRelation.valueOf(argsBox.reln);
        }
        return new RemoveEdge(reln, argsBox.govNodeName, argsBox.dep);
      } else if (command.equalsIgnoreCase(RemoveNamedEdge.LABEL)) {
        return new RemoveNamedEdge(argsBox.edge);
      } else if (command.equalsIgnoreCase(KillAllIncomingEdges.LABEL)) {
        if (argsBox.nodes.size() != 1) {
          throw new SsurgeonParseException("Cannot make a KillAllIncomingEdges out of " + argsBox.nodes.size() + " nodes");
        }
        return new KillAllIncomingEdges(argsBox.nodes.get(0));
      } else if (command.equalsIgnoreCase(CombineMWT.LABEL)) {
        return new CombineMWT(argsBox.nodes, argsBox.annotations.get("word"));
      } else if (command.equalsIgnoreCase(SetPhraseHead.LABEL)) {
        GrammaticalRelation reln = GrammaticalRelation.valueOf(language, argsBox.reln);
        return new SetPhraseHead(argsBox.nodes, argsBox.headIndex, reln, argsBox.weight);
      } else if (command.equalsIgnoreCase(SplitWord.LABEL)) {
        GrammaticalRelation reln = GrammaticalRelation.valueOf(language, argsBox.reln);
        if (argsBox.regex.size() > 0 && argsBox.exact.size() > 0) {
          throw new SsurgeonParseException("Found both regex and exact in the splits for splitWord");
        }
        if (argsBox.regex.size() > 0) {
          return new SplitWord(argsBox.nodes.get(0), argsBox.regex, argsBox.headIndex, reln, argsBox.name, false);
        } else {
          return new SplitWord(argsBox.nodes.get(0), argsBox.exact, argsBox.headIndex, reln, argsBox.name, true);
        }
      } else if (command.equalsIgnoreCase(ReindexGraph.LABEL)) {

View on GitHub (pinned to 1b7edd19c4)