{"record":{"id":"24ba7cdc1025b07c","repo":"stanfordnlp/CoreNLP","slug":"cannot-make-an-editnode-out-of-argsbox-nodes-s","errorCode":null,"errorMessage":"Cannot make an EditNode out of \" + argsBox.nodes.size() + \" nodes.  Please use exactly one -node","messagePattern":"Cannot make an EditNode out of \" \\+ argsBox\\.nodes\\.size\\(\\) \\+ \" nodes\\.  Please use exactly one -node","errorType":"exception","errorClass":"SsurgeonParseException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/Ssurgeon.java","lineNumber":641,"sourceCode":"          throw new SsurgeonParseException(\"Relation not specified for AddEdge\");\n        }\n        GrammaticalRelation reln = GrammaticalRelation.valueOf(language, argsBox.reln);\n        return new AddEdge(argsBox.govNodeName, argsBox.dep, reln, argsBox.weight);\n      } else if (command.equalsIgnoreCase(ReattachNamedEdge.LABEL)) {\n          return new ReattachNamedEdge(argsBox.edge, argsBox.govNodeName, argsBox.dep);\n      } else if (command.equalsIgnoreCase(DeleteGraphFromNode.LABEL)) {\n        if (argsBox.nodes.size() != 1) {\n          throw new SsurgeonParseException(\"Cannot make a DeleteGraphFromNode out of \" + argsBox.nodes.size() + \" nodes\");\n        }\n        return new DeleteGraphFromNode(argsBox.nodes.get(0));\n      } else if (command.equalsIgnoreCase(DeleteLeaf.LABEL)) {\n        if (argsBox.nodes.size() != 1) {\n          throw new SsurgeonParseException(\"Cannot make a DeleteLeaf out of \" + argsBox.nodes.size() + \" nodes\");\n        }\n        return new DeleteLeaf(argsBox.nodes.get(0));\n      } else if (command.equalsIgnoreCase(EditNode.LABEL)) {\n        if (argsBox.nodes.size() != 1) {\n          throw new SsurgeonParseException(\"Cannot make an EditNode out of \" + argsBox.nodes.size() + \" nodes.  Please use exactly one -node\");\n        }\n        return new EditNode(argsBox.nodes.get(0), argsBox.annotations, argsBox.updateMorphoFeatures, argsBox.remove, argsBox.removeMorphoFeatures);\n      } else if (command.equalsIgnoreCase(Lemmatize.LABEL)) {\n        if (argsBox.nodes.size() != 1) {\n          throw new SsurgeonParseException(\"Cannot make a Lemmatize out of \" + argsBox.nodes.size() + \" nodes.  Please use exactly one -node\");\n        }\n        return new Lemmatize(argsBox.nodes.get(0), language);\n      } else if (command.equalsIgnoreCase(MergeNodes.LABEL)) {\n        if (argsBox.nodes.size() < 2) {\n          throw new SsurgeonParseException(\"Cannot make a MergeNodes out of fewer than 2 nodes (got \" + argsBox.nodes.size() + \")\");\n        }\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);","sourceCodeStart":623,"sourceCodeEnd":659,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/Ssurgeon.java#L623-L659","documentation":"EditNode modifies exactly one node, so parseEditLine requires argsBox.nodes.size() == 1. Any other count raises SsurgeonParseException('Cannot make an EditNode out of N nodes. Please use exactly one -node').","triggerScenarios":"An 'editnode' line with zero or 2+ -node flags; other flags like -lemma/-pos/-ner don't count — only -node flags populate nodes.","commonSituations":"Trying to batch-edit several matched nodes in one editnode call; typo of the flag (-nodes is a different box for ops like lemmatize/merge) leaving the node list empty while other flags accumulate.","solutions":["Use exactly one -node <name> flag on the editnode line.","Create one editnode edit per target node in the rule's edit list.","Check flag spelling: -node populates nodes for editnode; verify your value names an existing named node."],"exampleFix":"// before\neditnode -node a -node b -lemma x\n// after\neditnode -node a -lemma x\neditnode -node b -lemma x","handlingStrategy":"validation","validationCode":"int count = countFlagOccurrences(line, \"-node\");\nif (line.startsWith(\"editnode\") && count != 1)\n  throw new IllegalArgumentException(\"editnode needs exactly one -node, got \" + count);","typeGuard":null,"tryCatchPattern":"try { parseEditLine(line, attrs, lang); } catch (SsurgeonParseException e) { if (e.getMessage().startsWith(\"Cannot make an EditNode\")) log.error(\"editnode requires exactly one -node: \" + line); }","preventionTips":["One editnode edit per target node","Don't confuse -node with -nodes for single-target ops","Validate rule files at load time"],"tags":["parsing","ssurgeon","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"}