{"record":{"id":"288cce47f043bbbf","repo":"stanfordnlp/CoreNLP","slug":"spanishlexer-invalid-option-value-in-constructor-288cce","errorCode":null,"errorMessage":"SpanishLexer: Invalid option value in constructor: ","messagePattern":"SpanishLexer: Invalid option value in constructor: ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/international/spanish/process/SpanishLexer.flex","lineNumber":175,"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(\"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","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/international/spanish/process/SpanishLexer.flex#L157-L193","documentation":"SpanishLexer throws this IllegalArgumentException when a known option key receives a value not among the literals the constructor accepts. The 'untokenizable' option's switch accepts exactly noneDelete, noneInsert, firstDelete, firstKeep, allKeep; anything else hits the default branch and throws. Invalid values for known keys are fatal, unlike invalid keys.","triggerScenarios":"new SpanishLexer(reader, tf, options) with e.g. \"untokenizable\" -> \"delete\" or \"all-delete\"; or any other recognized key given an unrecognized value.","commonSituations":"Misspelling camelCase option values in properties files; reusing option vocabulary from other CoreNLP tokenizers; scripts generating options programmatically with wrong formats.","solutions":["Set untokenizable to exactly one of noneDelete, noneInsert, firstDelete, firstKeep, allKeep.","Check SpanishLexer.flex constructor for the accepted values of each option key.","Validate the options map before construction against the documented key/value pairs.","The message includes key and value (\"SpanishLexer: Invalid option value in constructor: <key>: <value>\"); use it to pinpoint the bad entry."],"exampleFix":"// before\nprops.put(\"untokenizable\", \"all-delete\");\n// after\nprops.put(\"untokenizable\", \"allKeep\");","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 SpanishLexer(reader, tf, options);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"SpanishLexer: Invalid option value in constructor\")) {\n    options.put(\"untokenizable\", \"noneDelete\");\n    lex = new SpanishLexer(reader, tf, options);\n  } else throw e;\n}","preventionTips":["Whitelist exact camelCase values for the untokenizable option.","Avoid sharing option maps between tokenizers with different vocabularies.","Smoke-test lexer construction in CI with the real config files."],"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-17T15:17:12.973Z"}