{"record":{"id":"1a7247ec39e49dfc","repo":"stanfordnlp/CoreNLP","slug":"unrecognized-compound-relation-s-arg","errorCode":null,"errorMessage":"Unrecognized compound relation ${s} ${arg}","messagePattern":"Unrecognized compound relation (.+?) (.+?)","errorType":"validation","errorClass":"ParseException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/trees/tregex/Relation.java","lineNumber":166,"sourceCode":"        r = new IthChildOf(Integer.parseInt(arg));\n        break;\n      case \"<+\":\n        r = new UnbrokenCategoryDominates(arg, basicCatFunction);\n        break;\n      case \">+\":\n        r = new UnbrokenCategoryIsDominatedBy(arg, basicCatFunction);\n        break;\n      case \".+\":\n        r = new UnbrokenCategoryPrecedes(arg, basicCatFunction);\n        break;\n      case \",+\":\n        r = new UnbrokenCategoryFollows(arg, basicCatFunction);\n        break;\n      case \"<<<\":\n        r = new AncestorOfIthLeaf(Integer.parseInt(arg));\n        break;\n      default:\n        throw new ParseException(\"Unrecognized compound relation \" + s + ' '\n            + arg);\n    }\n    return Interner.globalIntern(r);\n  }\n\n  /**\n   * Produce a TregexPattern which represents the given MULTI_RELATION\n   * and its children\n   */\n  static TregexPattern constructMultiRelation(String s, List<DescriptionPattern> children,\n                                              Function<String, String> basicCatFunction,\n                                              HeadFinder headFinder) throws ParseException {\n    if (s.equals(\"<...\")) {\n      List<TregexPattern> newChildren = Generics.newArrayList();\n      for (int i = 0; i < children.size(); ++i) {\n        Relation rel = getRelation(\"<\", Integer.toString(i + 1), basicCatFunction, headFinder); \n        DescriptionPattern oldChild = children.get(i);\n        TregexPattern newChild = new DescriptionPattern(rel, oldChild);","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/trees/tregex/Relation.java#L148-L184","documentation":"Relation.getRelation() also handles compound relations that take an argument (e.g. <<#, <<:, <<<); an unrecognized compound symbol combined with its argument falls to the default branch and throws ParseException naming both the symbol and the argument. It indicates an invalid compound relation in a tregex query.","triggerScenarios":"A tregex query contains a compound relation symbol not in the supported set, e.g. getRelation(\"<<x\", \"NP\", basicCatFunction, headFinder) with a typo or version-mismatched operator.","commonSituations":"Typos such as '<<<' vs '<<' variants; copying queries from tregex tutorials for other languages/tools; running queries written for newer CoreNLP releases.","solutions":["Fix the compound relation symbol to a supported one (e.g. <<:, <<#, <<<, <<,), keeping its argument intact","Validate the argument (e.g. integer index for <<<) along with the symbol","Consult the Relation switch cases for the exact supported symbols in your version","Upgrade CoreNLP if the query syntax comes from a newer release"],"exampleFix":"// before\nRelation r = Relation.getRelation(\"<<<x\", \"3\", basicCatFunction, headFinder); // throws\n// after\nRelation r = Relation.getRelation(\"<<<\", \"3\", basicCatFunction, headFinder);","handlingStrategy":"try-catch","validationCode":"Set<String> compoundRels = Set.of(\"<<#\", \"<<,\", \">>#\", \">>,\", \"<<:\", \">>:\", \"<<<\", \"<<:\");\nif (!compoundRels.contains(s)) throw new IllegalArgumentException(\"Unknown compound relation: \" + s);","typeGuard":null,"tryCatchPattern":"try {\n  Relation r = Relation.getRelation(s, arg, basicCatFunction, headFinder);\n} catch (ParseException e) {\n  throw new TregexQueryException(\"Invalid compound relation '\" + s + \"' with arg '\" + arg + \"'\", e);\n}","preventionTips":["Double-check angle-bracket counts in compound operators (<< vs <<<)","Validate integer arguments for indexed relations before calling","Test queries against a small fixture tree in CI"],"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"}