stanfordnlp/CoreNLP · error · RuntimeException

Error creating custom coref system

Error message

Error creating custom coref system

What it means

Wraps reflective instantiation failures in CorefAlgorithm.fromProps when loading a custom coref algorithm: ClassNotFoundException, NoSuchMethodException, or constructor/instantiation errors for the class named by coref.algorithm.class.

Solutions

  1. Check the class name spelling and that it is on the classpath
  2. Ensure the class has a public (Properties, Dictionaries) constructor
  3. Verify the class implements CorefAlgorithm
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/edu/stanford/nlp/coref/CorefAlgorithm.java:45 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at src/edu/stanford/nlp/coref/CorefAlgorithm.java:45

    if (algorithm == CorefAlgorithmType.CLUSTERING) {
      return new ClusteringCorefAlgorithm(props, dictionaries);
    } else if (algorithm == CorefAlgorithmType.STATISTICAL) {
      return new StatisticalCorefAlgorithm(props, dictionaries);
    } else if (algorithm == CorefAlgorithmType.NEURAL) {
      return new NeuralCorefAlgorithm(props, dictionaries);
    } else if (algorithm == CorefAlgorithmType.FASTNEURAL) {
      return new FastNeuralCorefAlgorithm(props, dictionaries);
    } else if (algorithm == CorefAlgorithmType.CUSTOM) {
      String classname = PropertiesUtils.getString(props, "coref.algorithm.class", null);
      try {
        if (classname != null) {
          Class clazz = Class.forName(classname);
          return (CorefAlgorithm) clazz.getConstructor(Properties.class, Dictionaries.class).newInstance(props, dictionaries);
        } else {
          throw new RuntimeException("Please specify coref.algorithm.class");
        }
      } catch (Exception e) {
        throw new RuntimeException("Error creating custom coref system", e);
      }
    } else {
      try {
        return new HybridCorefSystem(props, dictionaries);
      } catch (Exception e) {
        throw new RuntimeException("Error creating hybrid coref system", e);
      }
    }
  }

}

View on GitHub (pinned to 1b7edd19c4)