{"record":{"id":"5505474daadf4a6b","repo":"stanfordnlp/CoreNLP","slug":"error-processing-field-from","errorCode":null,"errorMessage":"Error processing field : '' from (:): ","messagePattern":"Error processing field : '' from \\(:\\): ","errorType":"exception","errorClass":"java.lang.RuntimeException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/ling/tokensregex/PhraseTable.java","lineNumber":201,"sourceCode":"    Timing timer = new Timing();\n    timer.doing(\"Reading phrases: \" + filename);\n    BufferedReader br = IOUtils.readerFromString(filename);\n    String line;\n    int lineno = 0;\n    while ((line = br.readLine()) != null) {\n      String[] columns = fieldDelimiterPattern.split(line);\n      String phrase = columns[0];\n      // Pick map factory to use depending on number of tags we have\n      MapFactory<String,MutableDouble> mapFactory = (columns.length < 20)?\n              MapFactory.<String,MutableDouble>arrayMapFactory(): MapFactory.<String,MutableDouble>linkedHashMapFactory();\n      Counter<String> counts = new ClassicCounter<>(mapFactory);\n      for (int i = 1; i < columns.length; i++) {\n        String[] tagCount = countDelimiterPattern.split(columns[i], 2);\n        if (tagCount.length == 2) {\n          try {\n            counts.setCount(tagCount[0], Double.parseDouble(tagCount[1]));\n          } catch (NumberFormatException ex) {\n            throw new RuntimeException(\"Error processing field \" + i + \": '\" + columns[i] +\n                    \"' from (\" + filename + \":\" + lineno + \"): \" + line, ex);\n          }\n        } else {\n          throw new RuntimeException(\"Error processing field \" + i + \": '\" + columns[i] +\n                  \"' from + (\" + filename + \":\" + lineno + \"): \" + line);\n        }\n      }\n      addPhrase(phrase, null, counts);\n      lineno++;\n    }\n    br.close();\n    timer.done();\n  }\n\n  public void readPhrases(String filename, int phraseColIndex, int tagColIndex) throws IOException\n  {\n    if (phraseColIndex < 0) {\n      throw new IllegalArgumentException(\"Invalid phraseColIndex \" + phraseColIndex);","sourceCodeStart":183,"sourceCodeEnd":219,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/ling/tokensregex/PhraseTable.java#L183-L219","documentation":"PhraseTable.readPhrasesWithTagScores parses lines of 'phrase<TAB>tag:count ...'. If the tag:count field has two parts but the count part is not a parsable double, NumberFormatException is wrapped and rethrown as 'Error processing field i: ... from (file:line)'.","triggerScenarios":"A data file line whose column i looks like 'tag:value' (splits into 2 by the count delimiter) but where value is non-numeric, e.g. 'NN:high', 'VB:1,5', or a count with a stray character.","commonSituations":"Hand-edited or Excel-exported phrase tables with counts using thousand separators, commas, or text placeholders like 'n/a'.","solutions":["Fix the offending file line (file:line is in the message) so the count is a plain double (e.g. 'NN:12' or 'NN:12.5')","Normalize the count delimiter/format before loading (strip commas, use '.' decimal separator)","Pre-validate lines in your loader: attempt Double.parseDouble on the count segment and log bad lines"],"exampleFix":"// before (file line)\nhello\tNN:1,234\n// after\nhello\tNN:1234","handlingStrategy":"validation","validationCode":"String[] parts = col.split(\":\", 2);\nif (parts.length == 2) {\n    try { Double.parseDouble(parts[1]); } catch (NumberFormatException e) {\n        throw new IllegalArgumentException(\"Non-numeric count in line \" + lineno + \": \" + col);\n    }\n}","typeGuard":"static boolean isParsableDouble(String s) { try { Double.parseDouble(s); return true; } catch (NumberFormatException e) { return false; } }","tryCatchPattern":"try { table.readPhrasesWithTagScores(file); } catch (RuntimeException e) { if (e.getMessage().startsWith(\"Error processing field\")) { LOG.error(\"Fix data file: {}\", e.getMessage()); } throw e; }","preventionTips":["Use readPhrasesWithTagScores only for files in 'phrase\\ttag:count' format","Strip commas/locales from counts before loading","Lint phrase-table files with the parse logic before loading"],"tags":["tokensregex","number-format","file-parsing"],"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"}