{"record":{"id":"29318ff5802ececa","repo":"stanfordnlp/CoreNLP","slug":"splitword-expected-a-reln-to-represent-the-depend","errorCode":null,"errorMessage":"SplitWord expected a -reln to represent the dependency to use for the new words","messagePattern":"SplitWord expected a -reln to represent the dependency to use for the new words","errorType":"exception","errorClass":"SsurgeonParseException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/SplitWord.java","lineNumber":77,"sourceCode":"    }\n    if (exactSplit) {\n      this.exactPieces = new ArrayList<>(nodePieces);\n      this.nodeRegex = null;\n    } else {\n      this.nodeRegex = new ArrayList<>();\n      for (int i = 0; i < nodePieces.size(); ++i) {\n        this.nodeRegex.add(Pattern.compile(nodePieces.get(i)));\n      }\n      this.exactPieces = null;\n    }\n\n    if (headIndex == null) {\n      throw new SsurgeonParseException(\"SplitWord expected a -headIndex, 0-indexed for the word piece to use when chopping up the word\");\n    }\n    this.headIndex = headIndex;\n\n    if (relation == null) {\n      throw new SsurgeonParseException(\"SplitWord expected a -reln to represent the dependency to use for the new words\");\n    }\n    this.relation = relation;\n\n    if (nodeNames != null) {\n      String[] namePieces = nodeNames.split(\",\");\n      this.nodeNames = new HashMap<>();\n      for (String namePiece : namePieces) {\n        String[] pieces = namePiece.split(\"=\", 2);\n        if (pieces.length < 2) {\n          throw new SsurgeonParseException(\"SplitWord got a -name parameter which did not have a number for one of the names.  Should look like 0=foo,1=bar\");\n        }\n        int idx = Integer.valueOf(pieces[0]);\n        if (idx >= nodePieces.size()) {\n          throw new SsurgeonParseException(\"SplitWord got an index in -name which was larger than the largest possible split piece, \" + idx + \" (this is 0-indexed)\");\n        }\n        this.nodeNames.put(idx, pieces[1]);\n      }\n    } else {","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/SplitWord.java#L59-L95","documentation":"The new words produced by a SplitWord operation must be connected by a grammatical relation; this is supplied via the -reln flag as a GrammaticalRelation. If relation is null after the headIndex check, the constructor throws SsurgeonParseException.","triggerScenarios":"Constructing SplitWord without -reln (or with a null GrammaticalRelation as the fourth constructor argument), such as when the relation name could not be resolved by GrammaticalRelation.valueOf.","commonSituations":"Omitting -reln in the ssurgeon rule; passing an invalid relation string so the parser yields null; building the operation in Java and forgetting the relation argument.","solutions":["Add a valid -reln flag, e.g. -reln dep or -reln compound, matching a Universal Dependencies relation name","Ensure GrammaticalRelation.valueOf for your relation name returns non-null before constructing SplitWord","Pass an explicit GrammaticalRelation instance as the fourth constructor argument"],"exampleFix":"// before\nnew SplitWord(\"w\", pieces, 0, null, null, true);\n// after\nnew SplitWord(\"w\", pieces, 0, UniversalEnglishGrammaticalRelations.DEPENDENT, null, true);","handlingStrategy":"validation","validationCode":"GrammaticalRelation reln = GrammaticalRelation.valueOf(lang, relnName);\nif (reln == null) throw new IllegalArgumentException(\"-reln did not resolve to a GrammaticalRelation: \" + relnName);","typeGuard":null,"tryCatchPattern":"try { SplitWord sw = new SplitWord(node, pieces, headIndex, reln, names, exact); } catch (SsurgeonParseException e) { log.error(\"Missing -reln: \" + e.getMessage()); }","preventionTips":["Always pass -reln with a valid UD relation name","Resolve the relation name via GrammaticalRelation.valueOf before constructing","Use IDE constants (e.g. UniversalEnglishGrammaticalRelations) instead of raw strings in Java code"],"tags":["ssurgeon","constructor","missing-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}