stanfordnlp/CoreNLP · error · SsurgeonParseException

Invalid node encountered during Ssurgeon predicate…

Error message

Invalid node encountered during Ssurgeon predicate processing, node name="+eltName

What it means

While parsing a Ssurgeon test/predicate element, parseTest dispatches on the element name and if the node name matches no known predicate type it falls through to this SsurgeonParseException. It means the rules file contains an element that Ssurgeon does not recognize as a valid test node.

Solutions

  1. Check the element name in the XML against the supported Ssurgeon node test names and fix the typo/case
  2. Remove or relocate the unrecognized element (e.g. it may belong outside the predicate section)
  3. Confirm the CoreNLP version supports the test type you are using

Example fix

// before
<wordlst-test id="t1" .../>
// after
<wordlist-test id="t1" .../>
Defensive patterns

Strategy: validation

Validate before calling

Set<String> known = Set.of("wordlist-test", "regex-test", ...);
for (Element e : predChildren) {
  if (!known.contains(e.getName())) throw new IllegalArgumentException("Unknown node: " + e.getName());
}

Type guard

static boolean isKnownTestElement(Element e, Set<String> known) { return known.contains(e.getName()); }

Try / catch

try {
  Ssurgeon.init(resource);
} catch (SsurgeonParseException e) {
  log.error("Unrecognized Ssurgeon node: " + e.getMessage());
}

Prevention

When it happens

Trigger: An XML element appears inside a Ssurgeon rule's test/predicate section whose element name is not one of the recognized node-test types (typo, wrong case, or an element placed in the wrong section).

Common situations: Typos in element names like <wordlisttest> vs <wordlist-test>; copying elements from other XML formats; using test types from a newer CoreNLP version in an older parser.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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

Appendix: source

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

        }
        break;
      case SsurgeonPattern.PRED_WORDLIST_TEST_TAG:
        String id = elt.getAttribute(SsurgeonPattern.PRED_ID_ATTR);
        String resourceID = elt.getAttribute("resourceID");
        String typeStr = elt.getAttribute("type");
        String matchName = getEltText(elt).trim(); // node name to match on

        if (matchName == null) {
          throw new SsurgeonParseException("Could not find match name for " + elt);
        }
        if (id == null) {
          throw new SsurgeonParseException("No ID attribute for element = " + elt);
        }
        return new WordlistTest(id, resourceID, typeStr, matchName);
    }

    // Not a valid node, error out!
    throw new SsurgeonParseException("Invalid node encountered during Ssurgeon predicate processing, node name="+eltName);
  }



  /**
   * Reads in the test file and prints readable to string (for debugging).
   * Input file consists of semantic graphs, in compact form.
   */
  public void testRead(File tgtDirPath) throws Exception {
    List<SsurgeonPattern> patterns = readFromDirectory(tgtDirPath);

    System.out.println("Patterns, num = "+patterns.size());
    int num = 1;
    for (SsurgeonPattern pattern : patterns) {
      System.out.println("\n# "+(num++));
      System.out.println(pattern);
    }

View on GitHub (pinned to 1b7edd19c4)