{"record":{"id":"7d453d3f794acbbb","repo":"stanfordnlp/CoreNLP","slug":"invalid-node-encountered-during-ssurgeon-predicate","errorCode":null,"errorMessage":"Invalid node encountered during Ssurgeon predicate processing, node name=\"+eltName","messagePattern":"Invalid node encountered during Ssurgeon predicate processing, node name=\"\\+eltName","errorType":"exception","errorClass":"SsurgeonParseException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/Ssurgeon.java","lineNumber":955,"sourceCode":"        }\n        break;\n      case SsurgeonPattern.PRED_WORDLIST_TEST_TAG:\n        String id = elt.getAttribute(SsurgeonPattern.PRED_ID_ATTR);\n        String resourceID = elt.getAttribute(\"resourceID\");\n        String typeStr = elt.getAttribute(\"type\");\n        String matchName = getEltText(elt).trim(); // node name to match on\n\n        if (matchName == null) {\n          throw new SsurgeonParseException(\"Could not find match name for \" + elt);\n        }\n        if (id == null) {\n          throw new SsurgeonParseException(\"No ID attribute for element = \" + elt);\n        }\n        return new WordlistTest(id, resourceID, typeStr, matchName);\n    }\n\n    // Not a valid node, error out!\n    throw new SsurgeonParseException(\"Invalid node encountered during Ssurgeon predicate processing, node name=\"+eltName);\n  }\n\n\n\n  /**\n   * Reads in the test file and prints readable to string (for debugging).\n   * Input file consists of semantic graphs, in compact form.\n   */\n  public void testRead(File tgtDirPath) throws Exception {\n    List<SsurgeonPattern> patterns = readFromDirectory(tgtDirPath);\n\n    System.out.println(\"Patterns, num = \"+patterns.size());\n    int num = 1;\n    for (SsurgeonPattern pattern : patterns) {\n      System.out.println(\"\\n# \"+(num++));\n      System.out.println(pattern);\n    }\n","sourceCodeStart":937,"sourceCodeEnd":973,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/Ssurgeon.java#L937-L973","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Check the element name in the XML against the supported Ssurgeon node test names and fix the typo/case","Remove or relocate the unrecognized element (e.g. it may belong outside the predicate section)","Confirm the CoreNLP version supports the test type you are using"],"exampleFix":"// before\n<wordlst-test id=\"t1\" .../>\n// after\n<wordlist-test id=\"t1\" .../>","handlingStrategy":"validation","validationCode":"Set<String> known = Set.of(\"wordlist-test\", \"regex-test\", ...);\nfor (Element e : predChildren) {\n  if (!known.contains(e.getName())) throw new IllegalArgumentException(\"Unknown node: \" + e.getName());\n}","typeGuard":"static boolean isKnownTestElement(Element e, Set<String> known) { return known.contains(e.getName()); }","tryCatchPattern":"try {\n  Ssurgeon.init(resource);\n} catch (SsurgeonParseException e) {\n  log.error(\"Unrecognized Ssurgeon node: \" + e.getMessage());\n}","preventionTips":["Copy element names exactly from working example rule files","Pin the CoreNLP version so rule features match parser support","Lint rule XML element names against the known test-type list"],"tags":["xml","parsing","ssurgeon"],"backgroundTag":"schema-validation-failed","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}