{"record":{"id":"c81c4839324bf12e","repo":"stanfordnlp/CoreNLP","slug":"expected-left-paren-c81c48","errorCode":null,"errorMessage":"Expected left paren!","messagePattern":"Expected left paren!","errorType":"exception","errorClass":"ParserException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/util/StringParsingTask.java","lineNumber":90,"sourceCode":"      ch = read();\n      while (Character.isJavaIdentifierPart(ch) && !isEOF) {\n        sb.append(ch);\n        ch = read();\n      }\n    }\n    unread();\n    // log.info(\"Read text: [\"+sb+\"]\");\n    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()) {","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/util/StringParsingTask.java#L72-L108","documentation":"StringParsingTask.readLeftParen reads whitespace and then expects the next character to be an opening parenthesis '(' during parsing of an encoded string form. If the character is not a left paren it throws ParserException('Expected left paren!'), signaling the input string does not match the expected grammatical format.","triggerScenarios":"Invoking a parser built on StringParsingTask (e.g. parsing an IntUni/Pair-style encoded value) whose input does not start with '(' after optional whitespace, such as feeding a value without the surrounding parentheses the parser requires.","commonSituations":"Malformed serialized values or cached results produced by a different format/version; hand-edited data files where parentheses were dropped; passing raw values where parenthesized expressions are expected.","solutions":["Ensure the input string is wrapped in the expected parenthesized form, e.g. '(a,b)'","Validate the input format before parsing (starts with '(' and ends with ')')","Regenerate the data from the library's own writer/encoder instead of hand-editing"],"exampleFix":"// before\nString input = \"a,b\"; // missing parens\n// after\nString input = \"(a,b)\";","handlingStrategy":"validation","validationCode":"String t = input.trim();\nif (!t.startsWith(\"(\")) throw new IllegalArgumentException(\"Encoded value must start with '(': \" + input);","typeGuard":null,"tryCatchPattern":"try {\n  task.parse();\n} catch (ParserException e) {\n  log.error(\"Malformed encoded value '\" + input + \"': \" + e.getMessage());\n}","preventionTips":["Always wrap encoded values in parentheses as the parser expects","Avoid hand-editing serialized values; regenerate with the library's writer","Validate balance of parens before parsing"],"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"}