stanfordnlp/CoreNLP · error · RuntimeException

Error initializing FeatureExtractorRunner

Error message

Error initializing FeatureExtractorRunner

What it means

FeatureExtractorRunner's constructor deserializes a prebuilt dataset map from StatisticalCorefTrainer.datasetFile; any Exception is wrapped in RuntimeException("Error initializing FeatureExtractorRunner"). Without this dataset the runner cannot process documents.

Solutions

  1. Run the dataset-building step first so StatisticalCorefTrainer.datasetFile exists at the expected path
  2. Verify the dataset file path/properties are correct
  3. Use the same CoreNLP version to read the file that wrote it (avoid InvalidClassException)
  4. Inspect e.getCause() (FileNotFoundException vs ClassCastException vs IOException) to pick the fix

Example fix

// before
// eval/export run without having built the dataset
// after
// 1) run the dataset builder:  DatasetBuilder (writes datasetFile)
// 2) then run the pipeline that constructs FeatureExtractorRunner
Defensive patterns

Strategy: validation

Validate before calling

java.io.File ds = new java.io.File(StatisticalCorefTrainer.datasetFile.toString());
// or the configured dataset path
if (StatisticalCorefTrainer.datasetFile == null || !new java.io.File("dataset file path").canRead())
  throw new IllegalStateException("Run DatasetBuilder first — dataset file missing");

Try / catch

try {
  FeatureExtractorRunner r = new FeatureExtractorRunner(props, dictionaries);
} catch (RuntimeException e) {
  if ("Error initializing FeatureExtractorRunner".equals(e.getMessage()))
    throw new IllegalStateException("Dataset file missing/incompatible, cause: " + e.getCause(), e);
  throw e;
}

Prevention

When it happens

Trigger: Constructing FeatureExtractorRunner in a training/export pipeline when the dataset file (StatisticalCorefTrainer.datasetFile) is missing, unreadable, was serialized with an incompatible class version, or is corrupted.

Common situations: Dataset file never generated (running the eval/export stage before the dataset-building stage); deserialization InvalidClassException after upgrading CoreNLP versions; wrong path in properties.

Related errors


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

Appendix: source

Thrown at src/edu/stanford/nlp/coref/statistical/FeatureExtractorRunner.java:32

/**
 * Runs feature extraction over coreference documents.
 * @author Kevin Clark
 */
public class FeatureExtractorRunner implements CorefDocumentProcessor {
  private final FeatureExtractor extractor;
  private final Compressor<String> compressor;

  private final Map<Integer, Map<Pair<Integer, Integer>, Boolean>> dataset;
  private final List<DocumentExamples> documents;

  public FeatureExtractorRunner(Properties props, Dictionaries dictionaries) {
    documents = new ArrayList<>();
    compressor = new Compressor<>();
    extractor = new FeatureExtractor(props, dictionaries, compressor);
    try {
      dataset = IOUtils.readObjectFromFile(StatisticalCorefTrainer.datasetFile);
    } catch(Exception e) {
      throw new RuntimeException("Error initializing FeatureExtractorRunner", e);
    }
  }

  @Override
  public void process(int id, Document document) {
    if (dataset.containsKey(id)) {
      documents.add(extractor.extract(id, document, dataset.get(id)));
    }
  }

  @Override
  public void finish() throws Exception {
    IOUtils.writeObjectToFile(documents, StatisticalCorefTrainer.extractedFeaturesFile);
    IOUtils.writeObjectToFile(compressor, StatisticalCorefTrainer.compressorFile);
  }
}

View on GitHub (pinned to 1b7edd19c4)