{"record":{"id":"8a2bd1924cd055a9","repo":"stanfordnlp/CoreNLP","slug":"error-initializing-featureextractorrunner","errorCode":null,"errorMessage":"Error initializing FeatureExtractorRunner","messagePattern":"Error initializing FeatureExtractorRunner","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/coref/statistical/FeatureExtractorRunner.java","lineNumber":32,"sourceCode":"/**\n * Runs feature extraction over coreference documents.\n * @author Kevin Clark\n */\npublic class FeatureExtractorRunner implements CorefDocumentProcessor {\n  private final FeatureExtractor extractor;\n  private final Compressor<String> compressor;\n\n  private final Map<Integer, Map<Pair<Integer, Integer>, Boolean>> dataset;\n  private final List<DocumentExamples> documents;\n\n  public FeatureExtractorRunner(Properties props, Dictionaries dictionaries) {\n    documents = new ArrayList<>();\n    compressor = new Compressor<>();\n    extractor = new FeatureExtractor(props, dictionaries, compressor);\n    try {\n      dataset = IOUtils.readObjectFromFile(StatisticalCorefTrainer.datasetFile);\n    } catch(Exception e) {\n      throw new RuntimeException(\"Error initializing FeatureExtractorRunner\", e);\n    }\n  }\n\n  @Override\n  public void process(int id, Document document) {\n    if (dataset.containsKey(id)) {\n      documents.add(extractor.extract(id, document, dataset.get(id)));\n    }\n  }\n\n  @Override\n  public void finish() throws Exception {\n    IOUtils.writeObjectToFile(documents, StatisticalCorefTrainer.extractedFeaturesFile);\n    IOUtils.writeObjectToFile(compressor, StatisticalCorefTrainer.compressorFile);\n  }\n}\n","sourceCodeStart":14,"sourceCodeEnd":49,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/coref/statistical/FeatureExtractorRunner.java#L14-L49","documentation":"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.","triggerScenarios":"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.","commonSituations":"Dataset file never generated (running the eval/export stage before the dataset-building stage); deserialization InvalidClassException after upgrading CoreNLP versions; wrong path in properties.","solutions":["Run the dataset-building step first so StatisticalCorefTrainer.datasetFile exists at the expected path","Verify the dataset file path/properties are correct","Use the same CoreNLP version to read the file that wrote it (avoid InvalidClassException)","Inspect e.getCause() (FileNotFoundException vs ClassCastException vs IOException) to pick the fix"],"exampleFix":"// before\n// eval/export run without having built the dataset\n// after\n// 1) run the dataset builder:  DatasetBuilder (writes datasetFile)\n// 2) then run the pipeline that constructs FeatureExtractorRunner","handlingStrategy":"validation","validationCode":"java.io.File ds = new java.io.File(StatisticalCorefTrainer.datasetFile.toString());\n// or the configured dataset path\nif (StatisticalCorefTrainer.datasetFile == null || !new java.io.File(\"dataset file path\").canRead())\n  throw new IllegalStateException(\"Run DatasetBuilder first — dataset file missing\");","typeGuard":null,"tryCatchPattern":"try {\n  FeatureExtractorRunner r = new FeatureExtractorRunner(props, dictionaries);\n} catch (RuntimeException e) {\n  if (\"Error initializing FeatureExtractorRunner\".equals(e.getMessage()))\n    throw new IllegalStateException(\"Dataset file missing/incompatible, cause: \" + e.getCause(), e);\n  throw e;\n}","preventionTips":["Run pipeline stages in order: dataset build before eval/export","Pin the CoreNLP version used to both write and read serialized datasets","Verify dataset file existence at startup","Check e.getCause() for FileNotFoundException vs InvalidClassException"],"tags":["java","corenlp","deserialization","initialization"],"backgroundTag":"module-init-failed","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"}