{"record":{"id":"e0fcce3e60f08934","repo":"stanfordnlp/CoreNLP","slug":"unrecognized-simple-relation","errorCode":null,"errorMessage":"Unrecognized simple relation ","messagePattern":"Unrecognized simple relation ","errorType":"exception","errorClass":"ParseException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/trees/tregex/Relation.java","lineNumber":116,"sourceCode":"    }\n\n    // finally try relations with headFinders\n    Relation r;\n    switch (s) {\n      case \">>#\":\n        r = new Heads(headFinder);\n        break;\n      case \"<<#\":\n        r = new HeadedBy(headFinder);\n        break;\n      case \">#\":\n        r = new ImmediatelyHeads(headFinder);\n        break;\n      case \"<#\":\n        r = new ImmediatelyHeadedBy(headFinder);\n        break;\n      default:\n        throw new ParseException(\"Unrecognized simple relation \" + s);\n    }\n\n    return Interner.globalIntern(r);\n  }\n\n  /**\n   * Static factory method for relations requiring an argument, including\n   * HAS_ITH_CHILD, ITH_CHILD_OF, UNBROKEN_CATEGORY_DOMINATES,\n   * UNBROKEN_CATEGORY_DOMINATED_BY, ANCESTOR_OF_ITH_LEAF.\n   *\n   * @param s The String representation of the relation\n   * @param arg The argument to the relation, as a string; could be a node\n   *          description or an integer\n   * @return The singleton static relation of the specified type with the\n   *         specified argument. Uses Interner to insure singleton-ity\n   * @throws ParseException If bad relation s\n   */\n  static Relation getRelation(String s, String arg,","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/trees/tregex/Relation.java#L98-L134","documentation":"Relation.getRelation() maps a simple tregex relation symbol (like <, >, <#, etc.) to a Relation object; an unknown symbol reaches the default branch and throws ParseException. It means a tregex query string contains a relation the parser does not recognize.","triggerScenarios":"A tregex expression contains a misspelled or unsupported simple relation symbol, passed via getRelation(String s, ...) during query parsing.","commonSituations":"Typos in tregex queries (e.g. '<> ' instead of '<<'); using relation syntax from other tree-query tools; using a relation added in a newer CoreNLP version than the one on the classpath.","solutions":["Correct the relation symbol in the tregex query to a documented simple relation (e.g. <, >, <<, >>, <#, $++, ...)","Check the Relation class docs for the exact symbol list in your CoreNLP version","Upgrade CoreNLP if the query uses a relation introduced after your current version","Verify quoting/escaping did not mangle the symbol before it reaches getRelation"],"exampleFix":"// before\nString rel = \"<>\"; // unknown\nRelation r = Relation.getRelation(rel, \"NP\", null, headFinder);\n// after\nString rel = \"<<\"; // documented relation\nRelation r = Relation.getRelation(rel, \"NP\", null, headFinder);","handlingStrategy":"try-catch","validationCode":"Set<String> simpleRels = Set.of(\"<\", \">\", \"<<\", \">>\", \"<<,\", \">>,\", \"<#\",\">#\", \"$+\", \"$-\", \"$++\", \"$--\", \".\", \",\", \"..\", \",:\", \":\", \"<:\", \">:\");\nif (!simpleRels.contains(rel)) throw new IllegalArgumentException(\"Unknown simple relation: \" + rel);","typeGuard":null,"tryCatchPattern":"try {\n  Relation r = Relation.getRelation(s, arg, basicCatFunction, headFinder);\n} catch (ParseException e) {\n  throw new TregexQueryException(\"Invalid relation in query near '\" + s + \"'\", e);\n}","preventionTips":["Validate tregex queries against the documented relation list before parsing","Keep a curated set of tested query templates instead of hand-typing symbols","Match CoreNLP version between query authoring and execution environments"],"tags":["java","tregex","parse-error","query"],"backgroundTag":"invalid-identifier-format","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"}