{"record":{"id":"abf106f3e62aa234","repo":"stanfordnlp/CoreNLP","slug":"s-invalid-options-key-in-constructor-s-n","errorCode":null,"errorMessage":"%s: Invalid options key in constructor: %s%n","messagePattern":"(.+?): Invalid options key in constructor: (.+?)%n","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/international/spanish/process/SpanishLexer.java","lineNumber":14188,"sourceCode":"              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(\"SpanishLexer: Invalid option value in constructor: \" + key + \": \" + value);\n            }\n          } else if (\"strictTreebank3\".equals(key)) {\n            strictTreebank3 = val;\n          } else {\n            throw new IllegalArgumentException(String.format(\"%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(\"SpanishLexer: the invertible option requires a CoreLabelTokenFactory\");\n          }\n          prevWord = (CoreLabel) tf.makeToken(\"\", 0, 0);\n          prevWordAfter = new StringBuilder();\n        }\n      }\n\n\n      /** Turn on to find out how things were tokenized. */\n      private static final boolean DEBUG = false;\n\n      /** A logger for this class */\n      private static final Redwood.RedwoodChannels logger = Redwood.channels(SpanishLexer.class);","sourceCodeStart":14170,"sourceCodeEnd":14206,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/international/spanish/process/SpanishLexer.java#L14170-L14206","documentation":"SpanishLexer's options-based constructor accepts only a fixed set of option keys (e.g. spanishTokenization, splitVerbs, splitNouns, invertible, strictTreebank3, untokenizable, etc.). When a key is passed that does not match any known option name, the constructor throws this IllegalArgumentException. It is a fail-fast guard against misspelled or unsupported tokenizer options.","triggerScenarios":"Calling new SpanishLexer(String options) (or the LexedTokenFactory variant) with a properties/option string containing a key that is not in the lexer's recognized option list, e.g. \"latinNormalization\" instead of a supported key.","commonSituations":"Typos in pipeline properties (e.g. tokenize.options in a Stanford CoreNLP configuration), copying options meant for PTBTokenizer into SpanishLexer, or upgrading CoreNLP where an option was removed/renamed.","solutions":["Check the option key spelling against the recognized keys in SpanishLexer's constructor and fix the typo.","Remove the unknown key if it is not supported by SpanishLexer (it may belong to a different tokenizer such as PTBTokenizer).","If configuring via CoreNLP properties, update the tokenize.options value to only SpanishLexer-supported keys.","Consult the CoreNLP tokenizer documentation for the current list of supported Spanish options after a version upgrade."],"exampleFix":"// before\nnew SpanishLexer(\"spanishTokenizaton=true, invertible=true\");\n// after\nnew SpanishLexer(\"spanishTokenization=true, invertible=true\");","handlingStrategy":"validation","validationCode":"Set<String> allowed = new HashSet<>(Arrays.asList(\"spanishTokenization\", \"splitVerbs\", \"splitNouns\", \"splitAll\", \"coptainCappedWords\", \"quoteStyle\", \"invertible\", \"strictTreebank3\", \"untokenizable\", \"tokenizeNLs\"));\nfor (String key : options.split(\",\")) {\n  String k = key.substring(0, key.indexOf('=') >= 0 ? key.indexOf('=') : key.length()).trim();\n  if (!allowed.contains(k)) throw new IllegalArgumentException(\"Unknown SpanishLexer option: \" + k);\n}","typeGuard":null,"tryCatchPattern":"try {\n  lexer = new SpanishLexer(options);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"Invalid options key\")) {\n    log.error(\"Bad tokenizer option key, check tokenize.options: \" + e.getMessage());\n  }\n  throw e;\n}","preventionTips":["Copy option keys from the official SpanishLexer/CoreNLP docs, not from other tokenizers.","Keep tokenize.options strings short and review each key against the constructor's recognized set.","Unit-test pipeline properties at startup so a bad key fails immediately, not mid-corpus."],"tags":["tokenizer","configuration","illegal-argument"],"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"}