{"record":{"id":"499bb15b657ee56a","repo":"stanfordnlp/CoreNLP","slug":"relation-not-specified-for-addedge","errorCode":null,"errorMessage":"Relation not specified for AddEdge","messagePattern":"Relation not specified for AddEdge","errorType":"exception","errorClass":"SsurgeonParseException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/Ssurgeon.java","lineNumber":623,"sourceCode":"        return new SetRoots(newRoots);\n      } else if (command.equalsIgnoreCase(KillNonRootedNodes.LABEL)) {\n        return new KillNonRootedNodes();\n      }\n\n      // Parse the arguments based upon the type of command to execute.\n      final SsurgeonArgs argsBox = parseArgsBox(tuples1.length == 1 ? \"\" : tuples1[1], attributeArgs);\n\n      if (command.equalsIgnoreCase(AddDep.LABEL)) {\n        if (argsBox.reln == null) {\n          throw new SsurgeonParseException(\"Relation not specified for AddDep\");\n        }\n        GrammaticalRelation reln = GrammaticalRelation.valueOf(language, argsBox.reln);\n        return new AddDep(argsBox.govNodeName, reln, argsBox.annotations, argsBox.position);\n      } else if (command.equalsIgnoreCase(AddNode.LABEL)) {\n        return AddNode.createAddNode(argsBox.nodeString, argsBox.name);\n      } else if (command.equalsIgnoreCase(AddEdge.LABEL)) {\n        if (argsBox.reln == null) {\n          throw new SsurgeonParseException(\"Relation not specified for AddEdge\");\n        }\n        GrammaticalRelation reln = GrammaticalRelation.valueOf(language, argsBox.reln);\n        return new AddEdge(argsBox.govNodeName, argsBox.dep, reln, argsBox.weight);\n      } else if (command.equalsIgnoreCase(ReattachNamedEdge.LABEL)) {\n          return new ReattachNamedEdge(argsBox.edge, argsBox.govNodeName, argsBox.dep);\n      } else if (command.equalsIgnoreCase(DeleteGraphFromNode.LABEL)) {\n        if (argsBox.nodes.size() != 1) {\n          throw new SsurgeonParseException(\"Cannot make a DeleteGraphFromNode out of \" + argsBox.nodes.size() + \" nodes\");\n        }\n        return new DeleteGraphFromNode(argsBox.nodes.get(0));\n      } else if (command.equalsIgnoreCase(DeleteLeaf.LABEL)) {\n        if (argsBox.nodes.size() != 1) {\n          throw new SsurgeonParseException(\"Cannot make a DeleteLeaf out of \" + argsBox.nodes.size() + \" nodes\");\n        }\n        return new DeleteLeaf(argsBox.nodes.get(0));\n      } else if (command.equalsIgnoreCase(EditNode.LABEL)) {\n        if (argsBox.nodes.size() != 1) {\n          throw new SsurgeonParseException(\"Cannot make an EditNode out of \" + argsBox.nodes.size() + \" nodes.  Please use exactly one -node\");","sourceCodeStart":605,"sourceCodeEnd":641,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/Ssurgeon.java#L605-L641","documentation":"When parsing an AddEdge edit, parseEditLine requires -reln specifying the GrammaticalRelation of the new edge. If argsBox.reln is null, SsurgeonParseException('Relation not specified for AddEdge') is thrown.","triggerScenarios":"An 'addedge -gov ... -dep ...' line missing -reln; or -reln present but dropped due to malformed quote pairing in parseArgs leaving argsBox.reln null.","commonSituations":"Hand-written addedge rules omitting the relation; copying an addedge template and deleting the -reln line; argument-pair misalignment caused by an unmatched quote earlier in the line.","solutions":["Add -reln <relation> to the addedge line, e.g. -reln conj:and.","Ensure the relation name exists in the Universal/GrammaticalRelation set for your language.","Verify flag/value pairing by simplifying the line to minimal flags and re-adding arguments one at a time."],"exampleFix":"// before\naddedge -gov root -dep child\n// after\naddedge -gov root -dep child -reln punct","handlingStrategy":"validation","validationCode":"if (line.startsWith(\"addedge\") && !line.matches(\".*-reln\\\\s+\\\\S+.*\"))\n  throw new IllegalArgumentException(\"addedge line missing -reln: \" + line);","typeGuard":null,"tryCatchPattern":"try { parseEditLine(line, attrs, lang); } catch (SsurgeonParseException e) { if (e.getMessage().equals(\"Relation not specified for AddEdge\")) log.error(\"Add -reln to: \" + line); }","preventionTips":["Always include -reln on addedge lines","Verify -gov and -dep node names exist in the pattern","Lint required flags per ssurgeon operation"],"tags":["parsing","ssurgeon","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-15T23:17:13.987Z"}