{"record":{"id":"868afc0087d1fdc3","repo":"stanfordnlp/CoreNLP","slug":"expected-right-paren-868afc","errorCode":null,"errorMessage":"Expected right paren!","messagePattern":"Expected right paren!","errorType":"exception","errorClass":"ParserException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/util/StringParsingTask.java","lineNumber":98,"sourceCode":"    return sb.toString().intern();\n  }\n\n  // .....................................................................\n\n  protected void readLeftParen() {\n    // System.out.println(\"Read left.\");\n    readWhiteSpace();\n    char ch = read();\n    if (!isLeftParen(ch))\n      throw new ParserException(\"Expected left paren!\");\n  }\n\n  protected void readRightParen() {\n    // System.out.println(\"Read right.\");\n    readWhiteSpace();\n    char ch = read();\n    if (!isRightParen(ch)) \n      throw new ParserException(\"Expected right paren!\");\n  }\n\n  protected void readDot() {\n    readWhiteSpace();\n    if (isDot(peek())) read();\n  }\n\n  protected void readWhiteSpace() {\n    char ch = read();\n    while (isWhiteSpace(ch) && !isEOF()) {\n      ch = read();\n    }\n    unread();\n  }\n\n  // .....................................................................\n\n  protected char read() {","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/util/StringParsingTask.java#L80-L116","documentation":"StringParsingTask.readRightParen consumes whitespace and expects the next character to be a closing parenthesis ')'. If it is not, ParserException('Expected right paren!') is thrown, meaning the encoded expression ended or deviated before the closing paren was found.","triggerScenarios":"Parsing an encoded string where after reading the inner elements the next character is not ')', e.g. truncated input like '(a,b', extra tokens inside the parens, or a wrong closing character.","commonSituations":"Truncated files or cut-and-paste that dropped the final character; strings built manually with unbalanced parentheses; mixing encodings produced by different writers.","solutions":["Check the input string for balanced parentheses and completeness","Print/log the string being parsed and inspect the position where parsing fails","Regenerate the value using the library's encoder/toString method"],"exampleFix":"// before\nString input = \"(a,b\"; // truncated\n// after\nString input = \"(a,b)\";","handlingStrategy":"validation","validationCode":"String t = input.trim();\nif (!t.endsWith(\")\")) throw new IllegalArgumentException(\"Encoded value must end with ')': \" + input);","typeGuard":null,"tryCatchPattern":"try {\n  task.parse();\n} catch (ParserException e) {\n  log.error(\"Malformed encoded value '\" + input + \"': \" + e.getMessage());\n}","preventionTips":["Check inputs for balanced parentheses before parsing","Regenerate truncated data from source files rather than repairing by hand","Catch ParserException at parse boundaries and log the offending string"],"tags":["java","parsing","format"],"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-15T23:17:13.987Z"}