stanfordnlp/CoreNLP · error · SsurgeonParseException

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

Error message

Cannot make a Lemmatize out of " + argsBox.nodes.size() + " nodes.  Please use exactly one -node

What it means

Lemmatize lemmatizes exactly one node, so parseEditLine requires argsBox.nodes.size() == 1. Any other count raises SsurgeonParseException('Cannot make a Lemmatize out of N nodes. Please use exactly one -node').

Solutions

  1. Use exactly one -node <name> flag on the lemmatize line.
  2. Add one lemmatize edit per node that needs lemmatization.
  3. Verify the named node exists in the rule's semgrex pattern (a named group or created node).

Example fix

// before
lemmatize -node a -node b
// after
lemmatize -node a
lemmatize -node b
Defensive patterns

Strategy: validation

Validate before calling

int count = countFlagOccurrences(line, "-node");
if (line.startsWith("lemmatize") && count != 1)
  throw new IllegalArgumentException("lemmatize needs exactly one -node, got " + count);

Try / catch

try { parseEditLine(line, attrs, lang); } catch (SsurgeonParseException e) { if (e.getMessage().startsWith("Cannot make a Lemmatize")) log.error("lemmatize requires exactly one -node: " + line); }

Prevention

When it happens

Trigger: A 'lemmatize' edit line with zero or multiple -node flags.

Common situations: Batch lemmatization attempts in a single edit; forgetting -node entirely; confusing this op with MergeNodes which requires >=2 nodes.

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/94dd8b22c87704ea. Report an issue: GitHub.

Appendix: source

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

          return new ReattachNamedEdge(argsBox.edge, argsBox.govNodeName, argsBox.dep);
      } else if (command.equalsIgnoreCase(DeleteGraphFromNode.LABEL)) {
        if (argsBox.nodes.size() != 1) {
          throw new SsurgeonParseException("Cannot make a DeleteGraphFromNode out of " + argsBox.nodes.size() + " nodes");
        }
        return new DeleteGraphFromNode(argsBox.nodes.get(0));
      } else if (command.equalsIgnoreCase(DeleteLeaf.LABEL)) {
        if (argsBox.nodes.size() != 1) {
          throw new SsurgeonParseException("Cannot make a DeleteLeaf out of " + argsBox.nodes.size() + " nodes");
        }
        return new DeleteLeaf(argsBox.nodes.get(0));
      } else if (command.equalsIgnoreCase(EditNode.LABEL)) {
        if (argsBox.nodes.size() != 1) {
          throw new SsurgeonParseException("Cannot make an EditNode out of " + argsBox.nodes.size() + " nodes.  Please use exactly one -node");
        }
        return new EditNode(argsBox.nodes.get(0), argsBox.annotations, argsBox.updateMorphoFeatures, argsBox.remove, argsBox.removeMorphoFeatures);
      } else if (command.equalsIgnoreCase(Lemmatize.LABEL)) {
        if (argsBox.nodes.size() != 1) {
          throw new SsurgeonParseException("Cannot make a Lemmatize out of " + argsBox.nodes.size() + " nodes.  Please use exactly one -node");
        }
        return new Lemmatize(argsBox.nodes.get(0), language);
      } else if (command.equalsIgnoreCase(MergeNodes.LABEL)) {
        if (argsBox.nodes.size() < 2) {
          throw new SsurgeonParseException("Cannot make a MergeNodes out of fewer than 2 nodes (got " + argsBox.nodes.size() + ")");
        }
        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);
        }

View on GitHub (pinned to 1b7edd19c4)