{"record":{"id":"a7e9fc94f197126e","repo":"stanfordnlp/CoreNLP","slug":"error-initializing-binder-bi","errorCode":null,"errorMessage":"Error initializing binder ${bi}","messagePattern":"Error initializing binder (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/time/Options.java","lineNumber":114,"sourceCode":"      nBinders = PropertiesUtils.getInt(props, name + \".binders\", 0);\n      binderClasses = new String[nBinders];\n      for (int i = 0; i < nBinders; ++i) {\n        String binderPrefix = name + \".binder.\" + (i + 1);\n        binderClasses[i] = props.getProperty(binderPrefix);\n      }\n    }\n    if (nBinders > 0 && System.getProperty(\"STS\") == null) {\n      binders = new Env.Binder[nBinders];\n      for (int i = 0; i < nBinders; i++) {\n        int bi = i+1;\n        String binderPrefix = name + \".binder.\" + bi;\n        try {\n          Class<Env.Binder> binderClass = (Class<Env.Binder>) Class.forName(binderClasses[i]);\n          binderPrefix = binderPrefix + '.';\n          binders[i] = binderClass.getDeclaredConstructor().newInstance();\n          binders[i].init(binderPrefix, props);\n        } catch (Exception ex) {\n          throw new RuntimeException(\"Error initializing binder \" + bi, ex);\n        }\n      }\n    }\n  }\n}\n","sourceCodeStart":96,"sourceCodeEnd":120,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/time/Options.java#L96-L120","documentation":"The Options constructor instantiates Env.Binder classes listed in a properties option by fully-qualified class name and calls their init() with a property prefix. Any failure to load, instantiate, or initialize a binder is wrapped in a RuntimeException naming the binder (bi, typically 'binderN' identifier) with the underlying exception as cause.","triggerScenarios":"Configuring a binder class name that is not on the classpath (ClassNotFoundException), has no no-arg constructor, whose constructor or init(prefix, props) throws, or a typo in the binder property value.","commonSituations":"Renaming/moving a Binder class without updating the properties file; missing dependency jar at runtime; a Binder's init throwing because required properties are absent.","solutions":["Inspect the cause chain to see whether the class was not found, could not be instantiated, or its init() threw.","Correct the fully-qualified binder class name in the properties file and ensure its jar/module is on the runtime classpath.","Ensure each binder class is public with a public no-argument constructor and that all properties it requires are present."],"exampleFix":"// before\nbinderClasses = edu.stanford.nlp.time.OldEnvBinder\n// after\nbinderClasses = edu.stanford.nlp.time.RulesFormatterEnv$MyEnvBinder // corrected FQCN that exists on classpath","handlingStrategy":"try-catch","validationCode":"String[] names = binderClassesCsv.split(\",\");\nfor (String n : names) {\n  try { Class.forName(n.trim()); }\n  catch (ClassNotFoundException e) { throw new IllegalArgumentException(\"Binder class not on classpath: \" + n); }\n}","typeGuard":null,"tryCatchPattern":"try {\n  Options opts = new Options(prefix, props);\n} catch (RuntimeException e) {\n  logger.severe(\"Binder init failed: \" + e.getMessage() + \", cause: \" + e.getCause());\n  throw e;\n}","preventionTips":["Verify binder FQCNs exist on the runtime classpath in CI","Ensure binder classes are public with public no-arg constructors","Smoke-test binder init against production properties files"],"tags":["reflection","configuration","classloading","options"],"backgroundTag":"class-not-found","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"}