stanfordnlp/CoreNLP · error · RuntimeException

Both parse.model and parse.executable properties must be…

Error message

Both parse.model and parse.executable properties must be specified if parse.type=charniak

What it means

AnnotatorImplementations.parse() supports 'stanford' and 'charniak' parser types; choosing parse.type=charniak requires both the path to the Charniak parser model and the path to its executable via properties. If either is missing it throws RuntimeException at pipeline setup time.

Solutions

  1. Set both properties: -parse.model /path/to/model and -parse.executable /path/to/bparser (or parse.model=..., parse.executable=... in a properties file)
  2. Verify exact key spellings: parse.model and parse.executable
  3. If you do not have the Charniak parser, remove parse.type or set parse.type=stanford to use the built-in Stanford parser
  4. Check for whitespace/null values in the properties file (empty value still fails the null check is avoided but binary must exist)

Example fix

// before
props.setProperty("parse.type", "charniak");
// after
props.setProperty("parse.type", "charniak");
props.setProperty("parse.model", "/path/to/charniak/model");
props.setProperty("parse.executable", "/path/to/bparser");
Defensive patterns

Strategy: validation

Validate before calling

Properties p = props;
if ("charniak".equalsIgnoreCase(p.getProperty("parse.type", "stanford"))) {
  if (p.getProperty("parse.model") == null || p.getProperty("parse.executable") == null)
    throw new IllegalArgumentException("parse.model and parse.executable required for charniak");
}

Try / catch

try {
  buildPipeline(props);
} catch (RuntimeException e) {
  if (e.getMessage().contains("parse.type=charniak")) {
    log.error("Add -parse.model and -parse.executable to your config");
  } else throw e;
}

Prevention

When it happens

Trigger: Configuring CoreNLP with parse.type=charniak while omitting parse.model or parse.executable (or misspelling either key).

Common situations: Copying Stanford-parser configs and switching type to charniak without adding the required keys, typo like parse.model_path, running on a machine where the Charniak binary path was never configured.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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

Appendix: source

Thrown at src/edu/stanford/nlp/pipeline/AnnotatorImplementations.java:140

  }

  /**
   * Annotate parse trees
   *
   * @param properties Properties that control the behavior of the parser. It use "parse.x" properties.
   * @return A ParserAnnotator
   */
  public Annotator parse(Properties properties) {
    String parserType = properties.getProperty("parse.type", "stanford");
    String maxLenStr = properties.getProperty("parse.maxlen");

    if (parserType.equalsIgnoreCase("stanford")) {
      return new ParserAnnotator("parse", properties);
    } else if (parserType.equalsIgnoreCase("charniak")) {
      String model = properties.getProperty("parse.model");
      String parserExecutable = properties.getProperty("parse.executable");
      if (model == null || parserExecutable == null) {
        throw new RuntimeException("Both parse.model and parse.executable properties must be specified if parse.type=charniak");
      }
      int maxLen = 399;
      if (maxLenStr != null) {
        maxLen = Integer.parseInt(maxLenStr);
      }

      return new CharniakParserAnnotator(model, parserExecutable, false, maxLen);
    } else {
      throw new RuntimeException("Unknown parser type: " + parserType + " (currently supported: stanford and charniak)");
    }
  }

  public Annotator custom(Properties properties, String property) {
    String customName = property;
    String customClassName = properties.getProperty(StanfordCoreNLP.CUSTOM_ANNOTATOR_PREFIX + property);
    if (property.startsWith(StanfordCoreNLP.CUSTOM_ANNOTATOR_PREFIX)) {
      customName = property.substring(StanfordCoreNLP.CUSTOM_ANNOTATOR_PREFIX.length());
      customClassName = properties.getProperty(property);

View on GitHub (pinned to 1b7edd19c4)