{"record":{"id":"2a4070403fc89fe4","repo":"stanfordnlp/CoreNLP","slug":"error-creating-custom-coref-system","errorCode":null,"errorMessage":"Error creating custom coref system","messagePattern":"Error creating custom coref system","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/coref/CorefAlgorithm.java","lineNumber":45,"sourceCode":"    if (algorithm == CorefAlgorithmType.CLUSTERING) {\n      return new ClusteringCorefAlgorithm(props, dictionaries);\n    } else if (algorithm == CorefAlgorithmType.STATISTICAL) {\n      return new StatisticalCorefAlgorithm(props, dictionaries);\n    } else if (algorithm == CorefAlgorithmType.NEURAL) {\n      return new NeuralCorefAlgorithm(props, dictionaries);\n    } else if (algorithm == CorefAlgorithmType.FASTNEURAL) {\n      return new FastNeuralCorefAlgorithm(props, dictionaries);\n    } else if (algorithm == CorefAlgorithmType.CUSTOM) {\n      String classname = PropertiesUtils.getString(props, \"coref.algorithm.class\", null);\n      try {\n        if (classname != null) {\n          Class clazz = Class.forName(classname);\n          return (CorefAlgorithm) clazz.getConstructor(Properties.class, Dictionaries.class).newInstance(props, dictionaries);\n        } else {\n          throw new RuntimeException(\"Please specify coref.algorithm.class\");\n        }\n      } catch (Exception e) {\n        throw new RuntimeException(\"Error creating custom coref system\", e);\n      }\n    } else {\n      try {\n        return new HybridCorefSystem(props, dictionaries);\n      } catch (Exception e) {\n        throw new RuntimeException(\"Error creating hybrid coref system\", e);\n      }\n    }\n  }\n\n}\n","sourceCodeStart":27,"sourceCodeEnd":57,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/coref/CorefAlgorithm.java#L27-L57","documentation":"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.","triggerScenarios":"Thrown at src/edu/stanford/nlp/coref/CorefAlgorithm.java:45 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the class name spelling and that it is on the classpath","Ensure the class has a public (Properties, Dictionaries) constructor","Verify the class implements CorefAlgorithm"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}