{"record":{"id":"8287aa896bd36dbf","repo":"stanfordnlp/CoreNLP","slug":"frenchlexer-invalid-option-value-in-constructor-8287aa","errorCode":null,"errorMessage":"FrenchLexer: Invalid option value in constructor: ","messagePattern":"FrenchLexer: Invalid option value in constructor: ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/international/french/process/FrenchLexer.flex","lineNumber":180,"sourceCode":"              untokenizable = UntokenizableOptions.NONE_DELETE;\n              break;\n            case \"firstDelete\":\n              untokenizable = UntokenizableOptions.FIRST_DELETE;\n              break;\n            case \"allDelete\":\n              untokenizable = UntokenizableOptions.ALL_DELETE;\n              break;\n            case \"noneKeep\":\n              untokenizable = UntokenizableOptions.NONE_KEEP;\n              break;\n            case \"firstKeep\":\n              untokenizable = UntokenizableOptions.FIRST_KEEP;\n              break;\n            case \"allKeep\":\n              untokenizable = UntokenizableOptions.ALL_KEEP;\n              break;\n            default:\n              throw new IllegalArgumentException(\"FrenchLexer: Invalid option value in constructor: \" + key + \": \" + value);\n          }\n        } else if (\"strictTreebank3\".equals(key)) {\n          strictTreebank3 = val;\n        } else {\n          System.err.printf(\"%s: Invalid options key in constructor: %s%n\", this.getClass().getName(), key);\n        }\n      }\n      // this.seenUntokenizableCharacter = false; // unnecessary, it's default initialized\n      if (invertible) {\n        if ( ! (tf instanceof CoreLabelTokenFactory)) {\n          throw new IllegalArgumentException(\"FrenchLexer: the invertible option requires a CoreLabelTokenFactory\");\n        }\n        prevWord = (CoreLabel) tf.makeToken(\"\", 0, 0);\n        prevWordAfter = new StringBuilder();\n      }\n    }\n\n","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/international/french/process/FrenchLexer.flex#L162-L198","documentation":"FrenchLexer throws this IllegalArgumentException when an option value passed to the constructor is not one of the accepted literals for that key. The clearest case is the 'untokenizable' option, whose switch only accepts noneDelete, noneInsert, firstDelete, firstKeep, and allKeep; any other value reaches the default branch. Unlike unknown keys (which are only logged to stderr), invalid values for a known key abort construction.","triggerScenarios":"new FrenchLexer(reader, tf, options) with a known option key whose value is wrong, e.g. \"untokenizable\" -> \"keepAll\" or \"deleteAll\" instead of the exact strings the switch expects.","commonSituations":"Misremembering the option vocabulary (e.g. writing \"all-delete\" instead of \"allDelete\"); reusing PTBTokenizer's untokenizable spellings that differ; properties files edited by hand or generated by other tooling.","solutions":["Set untokenizable to exactly one of: noneDelete, noneInsert, firstDelete, firstKeep, allKeep.","Check the constructor source in FrenchLexer.flex for the accepted values of the option key you are using.","Validate options against the known key/value vocabulary before construction.","Note the exception message includes both key and value: \"FrenchLexer: Invalid option value in constructor: <key>: <value>\" — use it to locate the offending entry."],"exampleFix":"// before\nprops.put(\"untokenizable\", \"deleteAll\");\n// after\nprops.put(\"untokenizable\", \"noneDelete\");","handlingStrategy":"validation","validationCode":"java.util.Set<String> ok = new java.util.HashSet<>(java.util.Arrays.asList(\n  \"noneDelete\",\"noneInsert\",\"firstDelete\",\"firstKeep\",\"allKeep\"));\nString v = options.get(\"untokenizable\");\nif (v != null && !ok.contains(v))\n  throw new IllegalArgumentException(\"untokenizable must be one of \" + ok + \", got: \" + v);","typeGuard":null,"tryCatchPattern":"try {\n  lex = new FrenchLexer(reader, tf, options);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"FrenchLexer: Invalid option value in constructor\")) {\n    // log key/value from message, fix options, retry once\n    options.put(\"untokenizable\", \"noneDelete\");\n    lex = new FrenchLexer(reader, tf, options);\n  } else throw e;\n}","preventionTips":["Use camelCase exactly as documented for option values.","Keep a whitelisted vocabulary for each option key in your config loader.","Fail fast in tests that construct the lexer with your production option maps."],"tags":["java","tokenization","configuration"],"backgroundTag":"invalid-config-value","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"}