{"record":{"id":"b0aa0e9f709aa21f","repo":"stanfordnlp/CoreNLP","slug":"name-unknown-field-field-cannot-find-suita","errorCode":null,"errorMessage":"${name}: Unknown field: ${field} cannot find suitable annotation class","messagePattern":"(.+?): Unknown field: (.+?) cannot find suitable annotation class","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/edu/stanford/nlp/pipeline/TokensRegexNERAnnotator.java","lineNumber":292,"sourceCode":"\n    } else {\n      headerFields = COMMA_DELIMITERS_PATTERN.split(headerProp);\n      // Take header fields and remove known headers to get annotation field names\n      List<String> fieldNames = new ArrayList<>();\n      List<Class> fieldClasses = new ArrayList<>();\n      for (String field : headerFields) {\n        if ( ! predefinedHeaderFields.contains(field)) {\n          Class fieldClass = EnvLookup.lookupAnnotationKeyWithClassname(null, field);\n          if (fieldClass == null) {\n            // check our properties\n            String classname = properties.getProperty(prefix + \"mapping.field.\" + field);\n            fieldClass = EnvLookup.lookupAnnotationKeyWithClassname(null, classname);\n          }\n          if (fieldClass != null) {\n            fieldNames.add(field);\n            fieldClasses.add(fieldClass);\n          } else {\n            logger.warn(name + \": Unknown field: \" + field + \" cannot find suitable annotation class\");\n          }\n        }\n      }\n      \n      annotationFieldnames = new String[fieldNames.size()];\n      fieldNames.toArray(annotationFieldnames);\n      annotationFields = fieldClasses;\n    }\n\n    String noDefaultOverwriteLabelsProp = properties.getProperty(prefix + \"noDefaultOverwriteLabels\", \"CITY\");\n    this.noDefaultOverwriteLabels = Collections.unmodifiableSet(CollectionUtils.asSet(COMMA_DELIMITERS_PATTERN.split(noDefaultOverwriteLabelsProp)));\n    this.ignoreCase = PropertiesUtils.getBool(properties, prefix + \"ignorecase\", false);\n    this.verbose = PropertiesUtils.getBool(properties, prefix + \"verbose\", false);\n\n    if ( ! StringUtils.isNullOrEmpty(validPosRegex)) {\n      validPosPattern = Pattern.compile(validPosRegex);\n    } else {\n      validPosPattern = null;","sourceCodeStart":274,"sourceCodeEnd":310,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/pipeline/TokensRegexNERAnnotator.java#L274-L310","documentation":"TokensRegexNERAnnotator lets rules map fields to CoreNLP annotation classes. When a field name in a rule header cannot be resolved to any Annotation key class (via EnvLookup), the annotator logs this warning and simply omits that field. Rules still load, but the intended field will never be populated.","triggerScenarios":"Defining a TokensRegex rules file with a header field whose name (or explicit classname after ':') does not correspond to any CoreNLP annotation class, e.g. a typo like 'PartOfSpeach' or a custom name without a registered class.","commonSituations":"Typo'd field names in tokensregex rules; custom annotation keys used in rules without registering/looking up the class name; copy-pasting rule headers between CoreNLP versions where a field was renamed.","solutions":["Check the field name spelling in the rules file header against CoreNLP's CoreAnnotations classes","Use the Classname: suffix (e.g. myfield:edu.stanford.nlp.ling.CoreAnnotations$NormalizedNamedEntityTag) so the class can be found","Remove fields you don't actually need from the rule header","Verify the CoreNLP version supports the field you reference"],"exampleFix":"// before (rules file header)\ntokens = { word: /Barack/ }\nPosTag: NN\n// after\ntokens = { word: /Barack/ }\nPartOfSpeech: NN","handlingStrategy":"validation","validationCode":"Set<String> known = Set.of(\"text\",\"word\",\"lemma\",\"pos\",\"ner\",\"normalized\",\"partOfSpeech\");\nfor (String field : headerFields) {\n  if (!known.contains(field) && !field.contains(\":\"))\n    throw new IllegalArgumentException(\"Unknown rule field: \" + field);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Cross-check rule header fields against CoreAnnotations class names","Use the Field:classname syntax for custom keys","Keep a lint step that loads rule files and fails on unknown fields","Pin the CoreNLP version so field names match documentation"],"tags":["nlp","ner","tokensregex","configuration"],"backgroundTag":"unknown-config-field","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}