{"record":{"id":"2a32fb9a569877ca","repo":"stanfordnlp/CoreNLP","slug":"unable-to-process-ssurgeon-edit-line-editline","errorCode":null,"errorMessage":"Unable to process Ssurgeon edit line: \" + editLine","messagePattern":"Unable to process Ssurgeon edit line: \" \\+ editLine","errorType":"exception","errorClass":"SsurgeonParseException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/Ssurgeon.java","lineNumber":693,"sourceCode":"      } else if (command.equalsIgnoreCase(SetPhraseHead.LABEL)) {\n        GrammaticalRelation reln = GrammaticalRelation.valueOf(language, argsBox.reln);\n        return new SetPhraseHead(argsBox.nodes, argsBox.headIndex, reln, argsBox.weight);\n      } else if (command.equalsIgnoreCase(SplitWord.LABEL)) {\n        GrammaticalRelation reln = GrammaticalRelation.valueOf(language, argsBox.reln);\n        if (argsBox.regex.size() > 0 && argsBox.exact.size() > 0) {\n          throw new SsurgeonParseException(\"Found both regex and exact in the splits for splitWord\");\n        }\n        if (argsBox.regex.size() > 0) {\n          return new SplitWord(argsBox.nodes.get(0), argsBox.regex, argsBox.headIndex, reln, argsBox.name, false);\n        } else {\n          return new SplitWord(argsBox.nodes.get(0), argsBox.exact, argsBox.headIndex, reln, argsBox.name, true);\n        }\n      } else if (command.equalsIgnoreCase(ReindexGraph.LABEL)) {\n        return new ReindexGraph();\n      }\n      throw new SsurgeonParseException(\"Error in SsurgeonEdit.parseEditLine: command '\"+command+\"' is not supported\");\n    } catch (SsurgeonParseException e) {\n      throw new SsurgeonParseException(\"Unable to process Ssurgeon edit line: \" + editLine, e);\n    }\n  }\n\n  //public static SsurgeonPattern fromXML(String xmlString) throws Exception {\n  //SAXBuilder builder = new SAXBuilder();\n  //Document jdomDoc = builder.build(xmlString);\n  //jdomDoc.getRootElement().getChildren(SsurgeonPattern.SSURGEON_ELEM_TAG);\n  //}\n\n  /**\n   * Given a target filepath and a list of Ssurgeon patterns, writes them out as XML forms.\n   */\n  public static void writeToFile(File tgtFile, List<SsurgeonPattern> patterns) {\n    try {\n      Document domDoc = createPatternXMLDoc(patterns);\n      if (domDoc != null) {\n        Transformer tformer = TransformerFactory.newInstance().newTransformer();\n        tformer.setOutputProperty(OutputKeys.INDENT, \"yes\");","sourceCodeStart":675,"sourceCodeEnd":711,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/Ssurgeon.java#L675-L711","documentation":"This is the wrapper exception thrown by parseEditLine's catch block: whenever any SsurgeonParseException occurs while processing an edit line, it is rethrown as 'Unable to process Ssurgeon edit line: <editLine>' with the original exception as the cause. It identifies which line failed but the root cause is in the chained exception.","triggerScenarios":"Any invalid ssurgeon edit line (bad argument count, missing -reln, unknown command, invalid relation name via GrammaticalRelation.valueOf, etc.) processed through Ssurgeon.parseEditLine.","commonSituations":"Reading an ssurgeon resource file where one line is malformed; debugging requires inspecting the cause rather than this top-level message.","solutions":["Read the chained cause (getCause()) to find the actual parse failure","Locate the offending line in the ssurgeon file — editLine in the message names it","Fix the root cause (arguments, command name, relation name) in that line"],"exampleFix":"// before: only looking at the top message\n// after\ntry { SsurgeonEdit edit = Ssurgeon.parseEditLine(line); }\ncatch (SsurgeonParseException e) {\n  System.err.println(\"Line failed: \" + line + \" because \" + e.getCause());\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  SsurgeonEdit e = Ssurgeon.parseEditLine(line);\n} catch (SsurgeonParseException e) {\n  // always inspect the cause: this message only names the failing line\n  Throwable root = e;\n  while (root.getCause() != null) root = root.getCause();\n  log.severe(\"Edit line '\" + line + \"' failed: \" + root.getMessage());\n}","preventionTips":["Always unwrap getCause() when logging this wrapper exception","Include the ssurgeon file name and line number in your own error handling","Validate rules with a dry parse at startup instead of mid-pipeline"],"tags":["java","ssurgeon","parser","wrapped-exception"],"backgroundTag":"invalid-argument-format","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}