stanfordnlp/CoreNLP · error · SsurgeonParseException
Unable to process Ssurgeon edit line: " + editLine
Error message
Unable to process Ssurgeon edit line: " + editLine
What it means
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.
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
Example fix
// before: only looking at the top message
// after
try { SsurgeonEdit edit = Ssurgeon.parseEditLine(line); }
catch (SsurgeonParseException e) {
System.err.println("Line failed: " + line + " because " + e.getCause());
} Defensive patterns
Strategy: try-catch
Try / catch
try {
SsurgeonEdit e = Ssurgeon.parseEditLine(line);
} catch (SsurgeonParseException e) {
// always inspect the cause: this message only names the failing line
Throwable root = e;
while (root.getCause() != null) root = root.getCause();
log.severe("Edit line '" + line + "' failed: " + root.getMessage());
} Prevention
- 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
When it happens
Trigger: Any invalid ssurgeon edit line (bad argument count, missing -reln, unknown command, invalid relation name via GrammaticalRelation.valueOf, etc.) processed through Ssurgeon.parseEditLine.
Common situations: Reading an ssurgeon resource file where one line is malformed; debugging requires inspecting the cause rather than this top-level message.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- Cannot make a KillAllIncomingEdges out of " +…
- Cannot make a MergeNodes out of fewer than 2 nodes (got " +…
- Error in SsurgeonEdit.parseEditLine: command '"+command+"'…
- Found both regex and exact in the splits for splitWord
- Attempt to create ChineseSimWordAvgDepGrammar before…
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/2a32fb9a569877ca.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/semgraph/semgrex/ssurgeon/Ssurgeon.java:693
} else if (command.equalsIgnoreCase(SetPhraseHead.LABEL)) {
GrammaticalRelation reln = GrammaticalRelation.valueOf(language, argsBox.reln);
return new SetPhraseHead(argsBox.nodes, argsBox.headIndex, reln, argsBox.weight);
} else if (command.equalsIgnoreCase(SplitWord.LABEL)) {
GrammaticalRelation reln = GrammaticalRelation.valueOf(language, argsBox.reln);
if (argsBox.regex.size() > 0 && argsBox.exact.size() > 0) {
throw new SsurgeonParseException("Found both regex and exact in the splits for splitWord");
}
if (argsBox.regex.size() > 0) {
return new SplitWord(argsBox.nodes.get(0), argsBox.regex, argsBox.headIndex, reln, argsBox.name, false);
} else {
return new SplitWord(argsBox.nodes.get(0), argsBox.exact, argsBox.headIndex, reln, argsBox.name, true);
}
} else if (command.equalsIgnoreCase(ReindexGraph.LABEL)) {
return new ReindexGraph();
}
throw new SsurgeonParseException("Error in SsurgeonEdit.parseEditLine: command '"+command+"' is not supported");
} catch (SsurgeonParseException e) {
throw new SsurgeonParseException("Unable to process Ssurgeon edit line: " + editLine, e);
}
}
//public static SsurgeonPattern fromXML(String xmlString) throws Exception {
//SAXBuilder builder = new SAXBuilder();
//Document jdomDoc = builder.build(xmlString);
//jdomDoc.getRootElement().getChildren(SsurgeonPattern.SSURGEON_ELEM_TAG);
//}
/**
* Given a target filepath and a list of Ssurgeon patterns, writes them out as XML forms.
*/
public static void writeToFile(File tgtFile, List<SsurgeonPattern> patterns) {
try {
Document domDoc = createPatternXMLDoc(patterns);
if (domDoc != null) {
Transformer tformer = TransformerFactory.newInstance().newTransformer();
tformer.setOutputProperty(OutputKeys.INDENT, "yes");View on GitHub (pinned to 1b7edd19c4)