{"record":{"id":"d6ce917af9afaf24","repo":"stanfordnlp/CoreNLP","slug":"cannot-make-a-killallincomingedges-out-of-args","errorCode":null,"errorMessage":"Cannot make a KillAllIncomingEdges out of \" + argsBox.nodes.size() + \" nodes","messagePattern":"Cannot make a KillAllIncomingEdges out of \" \\+ argsBox\\.nodes\\.size\\(\\) \\+ \" nodes","errorType":"exception","errorClass":"SsurgeonParseException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/Ssurgeon.java","lineNumber":670,"sourceCode":"        }\n        return new MergeNodes(argsBox.nodes, argsBox.annotations);\n      } else if (command.equalsIgnoreCase(RelabelNamedEdge.LABEL)) {\n        if (argsBox.reln == null) {\n          throw new SsurgeonParseException(\"Relation not specified for AddEdge\");\n        }\n        GrammaticalRelation reln = GrammaticalRelation.valueOf(language, argsBox.reln);\n        return new RelabelNamedEdge(argsBox.edge, reln);\n      } else if (command.equalsIgnoreCase(RemoveEdge.LABEL)) {\n        GrammaticalRelation reln = null;\n        if (argsBox.reln != null) {\n          reln = GrammaticalRelation.valueOf(argsBox.reln);\n        }\n        return new RemoveEdge(reln, argsBox.govNodeName, argsBox.dep);\n      } else if (command.equalsIgnoreCase(RemoveNamedEdge.LABEL)) {\n        return new RemoveNamedEdge(argsBox.edge);\n      } else if (command.equalsIgnoreCase(KillAllIncomingEdges.LABEL)) {\n        if (argsBox.nodes.size() != 1) {\n          throw new SsurgeonParseException(\"Cannot make a KillAllIncomingEdges out of \" + argsBox.nodes.size() + \" nodes\");\n        }\n        return new KillAllIncomingEdges(argsBox.nodes.get(0));\n      } else if (command.equalsIgnoreCase(CombineMWT.LABEL)) {\n        return new CombineMWT(argsBox.nodes, argsBox.annotations.get(\"word\"));\n      } else if (command.equalsIgnoreCase(SetPhraseHead.LABEL)) {\n        GrammaticalRelation reln = GrammaticalRelation.valueOf(language, argsBox.reln);\n        return new SetPhraseHead(argsBox.nodes, argsBox.headIndex, reln, argsBox.weight);\n      } else if (command.equalsIgnoreCase(SplitWord.LABEL)) {\n        GrammaticalRelation reln = GrammaticalRelation.valueOf(language, argsBox.reln);\n        if (argsBox.regex.size() > 0 && argsBox.exact.size() > 0) {\n          throw new SsurgeonParseException(\"Found both regex and exact in the splits for splitWord\");\n        }\n        if (argsBox.regex.size() > 0) {\n          return new SplitWord(argsBox.nodes.get(0), argsBox.regex, argsBox.headIndex, reln, argsBox.name, false);\n        } else {\n          return new SplitWord(argsBox.nodes.get(0), argsBox.exact, argsBox.headIndex, reln, argsBox.name, true);\n        }\n      } else if (command.equalsIgnoreCase(ReindexGraph.LABEL)) {","sourceCodeStart":652,"sourceCodeEnd":688,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/Ssurgeon.java#L652-L688","documentation":"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.","triggerScenarios":"Edit line 'kill-all-incoming-edges' with zero -node entries, or mistakenly with multiple -node entries, hits `argsBox.nodes.size() != 1`.","commonSituations":"Authors reusing a multi-node rule template, or appending an extra -node when combining edits in an ssurgeon file.","solutions":["Give exactly one -node:NAME argument naming a node matched by the semgrex pattern","Remove any extra -node arguments if you intended a single target","Apply one kill-all-incoming-edges edit per target node instead of listing several nodes"],"exampleFix":"# before\nkill-all-incoming-edges -node:dep -node:gov\n# after\nkill-all-incoming-edges -node:dep","handlingStrategy":"validation","validationCode":"boolean validKillIncoming(String line) {\n  long n = java.util.Arrays.stream(line.split(\"\\\\s+\"))\n      .filter(t -> t.startsWith(\"-node:\")).count();\n  return line.startsWith(\"kill-all-incoming-edges\") && n == 1;\n}","typeGuard":null,"tryCatchPattern":"try {\n  SsurgeonEdit e = Ssurgeon.parseEditLine(line);\n} catch (SsurgeonParseException ex) {\n  log.warning(\"kill-all-incoming-edges requires exactly one -node: \" + line);\n}","preventionTips":["Emit one edit line per target node rather than listing multiple nodes","Test each ssurgeon rule on a sample SemgrexMatcher before deployment","Keep rule templates per edit type with fixed argument counts"],"tags":["java","ssurgeon","parser","argument-count"],"backgroundTag":"invalid-argument-value","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}