stanfordnlp/CoreNLP · error · java.lang.RuntimeException

Error processing field : '' from + (:):

Error message

Error processing field : '' from + (:): 

What it means

The sibling error of [413] in readPhrasesWithTagScores: thrown when a column's tag:count segment does NOT split into exactly 2 parts, i.e. it lacks the count delimiter entirely (note the 'from + (' in the message, a typo in the format string).

Solutions

  1. Use readPhrases (no tag scores) instead of readPhrasesWithTagScores for files without tag:count fields
  2. Fix the malformed column so each field is 'tag:count'
  3. Verify the delimiter between tag and count matches the file (countDelimiterPattern configuration)

Example fix

// before (file line, missing count)
hello	NN
// after
hello	NN:1
Defensive patterns

Strategy: validation

Validate before calling

for (String col : line.split("\t")) {
    if (!col.contains(":") || col.split(":", 2)[1].isEmpty())
        throw new IllegalArgumentException("Column missing tag:count: " + col);
}

Type guard

static boolean hasTagCountFormat(String col) { String[] p = col.split(":", 2); return p.length == 2 && !p[1].isEmpty(); }

Try / catch

try { table.readPhrasesWithTagScores(file); } catch (RuntimeException e) { if (e.getMessage().contains("from + (")) { LOG.error("Malformed tag:count column: {}", e.getMessage()); } throw e; }

Prevention

When it happens

Trigger: A data line column containing just a tag ('NN') or free text with no ':' (or whatever the configured delimiter is) after the phrase column.

Common situations: Mismatch between the file format and the loader — e.g. a phrase-only file (no tag scores) passed to readPhrasesWithTagScores, or a file using spaces instead of tabs/delimiters so columns merge.

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


AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10). Data as JSON: /api/errors/0e541b33e8a161af. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/ling/tokensregex/PhraseTable.java:205

    int lineno = 0;
    while ((line = br.readLine()) != null) {
      String[] columns = fieldDelimiterPattern.split(line);
      String phrase = columns[0];
      // Pick map factory to use depending on number of tags we have
      MapFactory<String,MutableDouble> mapFactory = (columns.length < 20)?
              MapFactory.<String,MutableDouble>arrayMapFactory(): MapFactory.<String,MutableDouble>linkedHashMapFactory();
      Counter<String> counts = new ClassicCounter<>(mapFactory);
      for (int i = 1; i < columns.length; i++) {
        String[] tagCount = countDelimiterPattern.split(columns[i], 2);
        if (tagCount.length == 2) {
          try {
            counts.setCount(tagCount[0], Double.parseDouble(tagCount[1]));
          } catch (NumberFormatException ex) {
            throw new RuntimeException("Error processing field " + i + ": '" + columns[i] +
                    "' from (" + filename + ":" + lineno + "): " + line, ex);
          }
        } else {
          throw new RuntimeException("Error processing field " + i + ": '" + columns[i] +
                  "' from + (" + filename + ":" + lineno + "): " + line);
        }
      }
      addPhrase(phrase, null, counts);
      lineno++;
    }
    br.close();
    timer.done();
  }

  public void readPhrases(String filename, int phraseColIndex, int tagColIndex) throws IOException
  {
    if (phraseColIndex < 0) {
      throw new IllegalArgumentException("Invalid phraseColIndex " + phraseColIndex);
    }
    Timing timer = new Timing();
    timer.doing("Reading phrases: " + filename);
    BufferedReader br = IOUtils.readerFromString(filename);

View on GitHub (pinned to 1b7edd19c4)