stanfordnlp/CoreNLP · error

Error: No training file provided in properties or via…

Error message

Error: No training file provided in properties or via command line --trainFile

What it means

BuildMultiWordRules.main is a CLI tool that infers multi-word tokenization rules from a training file. Before doing any work it checks the 'trainFile' property parsed from the command line; if absent it logs this error and returns without throwing. It exists because the tool cannot run without training data.

Solutions

  1. Pass the training file explicitly: -trainFile path/to/train.conllu.
  2. Check argument spelling matches exactly 'trainFile'.
  3. Run without args or consult the class source to confirm required flags.
  4. If using a properties file, ensure it contains a trainFile key reachable by StringUtils.argsToProperties.

Example fix

// before
java -cp ... edu.stanford.nlp.process.stattok.BuildMultiWordRules data/train.conllu
// after
java -cp ... edu.stanford.nlp.process.stattok.BuildMultiWordRules -trainFile data/train.conllu -multiWordRulesFile rules.txt
Defensive patterns

Strategy: validation

Validate before calling

Properties p = StringUtils.argsToProperties(args);
if (p.getProperty("trainFile") == null) {
    throw new IllegalArgumentException("Usage: BuildMultiWordRules -trainFile <train.conllu> -multiWordRulesFile <out>");
}

Prevention

When it happens

Trigger: Running `java edu.stanford.nlp.process.stattok.BuildMultiWordRules` without a -trainFile <path> argument (or properties entry), so properties.getProperty("trainFile") is null.

Common situations: Forgetting the argument name dash convention; passing the training file positionally instead of via -trainFile; misspelling the property (e.g. --trainingFile); reusing a script written for StatTokSentTrainer with different flags.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at src/edu/stanford/nlp/process/stattok/BuildMultiWordRules.java:26

import java.util.Map;
import java.util.Properties;

import edu.stanford.nlp.util.StringUtils;
import edu.stanford.nlp.util.logging.Redwood;

public class BuildMultiWordRules {
  private static final Redwood.RedwoodChannels logger = Redwood.channels(StatTokSentTrainer.class);

  // disallow making this class
  private BuildMultiWordRules() {}

  public static void main(String[] args) throws IOException {
    Properties properties 	= StringUtils.argsToProperties(args);
    String trainFile 		= properties.getProperty("trainFile", null);
    String multiWordRulesFile 	= properties.getProperty("multiWordRulesFile", null);

    if (trainFile == null){
      logger.err("Error: No training file provided in properties or via command line --trainFile");
      return;
    }

    if (multiWordRulesFile == null){
      logger.err("Error: No dest file provided in properties or via command line --multiWordRulesFile");
      return;
    }

    Map<String, String[]> rules = StatTokSentTrainer.inferMultiWordRules(trainFile);
    StatTokSentTrainer.writeMultiWordRules(multiWordRulesFile, rules);
  }
}

View on GitHub (pinned to 1b7edd19c4)