stanfordnlp/CoreNLP · error · SsurgeonParseException

Error in SsurgeonEdit.parseEditLine: command '"+command+"'…

Error message

Error in SsurgeonEdit.parseEditLine: command '"+command+"' is not supported

What it means

parseEditLine dispatches on the first token of an ssurgeon edit line against the known edit LABELs. If the command is not one of the supported labels (and no earlier branch matched), it throws SsurgeonParseException saying the command is not supported. The exception is then wrapped by the catch block with the full edit line.

Solutions

  1. Check the command spelling against Ssurgeon's supported LABEL constants for your CoreNLP version
  2. Upgrade/downgrade CoreNLP if the edit exists in a different version
  3. Register or extend the parser if you need a custom edit type

Example fix

# before
merge-nodes -node:dog -node:cat
# after
merge-grams -node:dog -node:cat
Defensive patterns

Strategy: validation

Validate before calling

java.util.Set<String> SUPPORTED = java.util.Set.of(
  "addedge","adddep","removeedge","removedep","relabelnamededge",
  "removenamededge","lemma","merge-grams","killallincomingedges",
  "splitword","combinemwt","setphrasehead","reindexgraph","setwordlist");
boolean knownCommand(String line) {
  String cmd = line.trim().split("\\s+")[0];
  return SUPPORTED.contains(cmd.toLowerCase());
}

Try / catch

try {
  SsurgeonEdit e = Ssurgeon.parseEditLine(line);
} catch (SsurgeonParseException ex) {
  log.severe("Unknown ssurgeon command, check LABEL constants: " + line);
}

Prevention

When it happens

Trigger: Any edit line whose command token is misspelled, miscased-sensitive after tokenization, or from an older/newer CoreNLP version's edit set, e.g. 'merge-nodes' instead of 'merge-grams'.

Common situations: Typos in ssurgeon files, following outdated documentation or tutorials for a different CoreNLP version, or custom edits that were never registered.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

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

      } 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)) {
        return new ReindexGraph();
      }
      throw new SsurgeonParseException("Error in SsurgeonEdit.parseEditLine: command '"+command+"' is not supported");
    } catch (SsurgeonParseException e) {
      throw new SsurgeonParseException("Unable to process Ssurgeon edit line: " + editLine, e);
    }
  }

  //public static SsurgeonPattern fromXML(String xmlString) throws Exception {
  //SAXBuilder builder = new SAXBuilder();
  //Document jdomDoc = builder.build(xmlString);
  //jdomDoc.getRootElement().getChildren(SsurgeonPattern.SSURGEON_ELEM_TAG);
  //}

  /**
   * Given a target filepath and a list of Ssurgeon patterns, writes them out as XML forms.
   */
  public static void writeToFile(File tgtFile, List<SsurgeonPattern> patterns) {
    try {
      Document domDoc = createPatternXMLDoc(patterns);
      if (domDoc != null) {

View on GitHub (pinned to 1b7edd19c4)