{"record":{"id":"4588ad6d6ef9454e","repo":"stanfordnlp/CoreNLP","slug":"ptblexer-invalid-option-value-in-constructor-k","errorCode":null,"errorMessage":"PTBLexer: Invalid option value in constructor: ${key}: ${value}","messagePattern":"PTBLexer: Invalid option value in constructor: (.+?): (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/process/PTBLexer.java","lineNumber":61166,"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(\"PTBLexer: Invalid option value in constructor: \" + key + \": \" + value);\n            }\n          } else if (\"strictTreebank3\".equals(key)) {\n            strictFraction = val;\n            strictAcronym = val;\n          } else if (\"strictFraction\".equals(key)) {\n            strictFraction = val;\n          } else if (\"strictAcronym\".equals(key)) {\n            strictAcronym = val;\n          } else {\n            throw new IllegalArgumentException(\"PTBLexer: Invalid options key in constructor: \" + key);\n          }\n        }\n        if (invertible) {\n          if ( ! (tf instanceof CoreLabelTokenFactory)) {\n            throw new IllegalArgumentException(\"PTBLexer: the invertible option requires a CoreLabelTokenFactory\");\n          }\n          prevWord = (CoreLabel) tf.makeToken(\"\", 0, 0);\n          prevWordAfter = new StringBuilder();","sourceCodeStart":61148,"sourceCodeEnd":61184,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/process/PTBLexer.java#L61148-L61184","documentation":"PTBLexer's constructor parses option keys; for keys whose values go through the untokenizable switch (noneDelete, firstDelete, firstKeep, noneKeep, allDelete, allKeep), an unrecognized value reaches the switch default and throws this IllegalArgumentException naming both key and value.","triggerScenarios":"Constructing PTBLexer/PTBTokenizer with untokenizable=<unknown>, e.g. untokenizable=keep or untokenizable=ignore; any other key that routes to this switch with an unexpected value.","commonSituations":"Guessing the accepted untokenizable values instead of reading UntokenizableOptions; truncating a properties line so the value is empty; upgrading CoreNLP and using values from another tokenizer library.","solutions":["Use one of the exact values: noneDelete, firstDelete, firstKeep, noneKeep, allDelete, allKeep.","Check UntokenizableOptions enum in your CoreNLP version for the authoritative list.","Fix empty/truncated values in your options string or properties file."],"exampleFix":"// before\nnew PTBTokenizer<>(reader, new CoreLabelTokenFactory(), \"untokenizable=keep\");\n// after\nnew PTBTokenizer<>(reader, new CoreLabelTokenFactory(), \"untokenizable=allKeep\");","handlingStrategy":"validation","validationCode":"Set<String> allowed = Set.of(\"noneDelete\",\"firstDelete\",\"firstKeep\",\"noneKeep\",\"allDelete\",\"allKeep\");\nif (key.equals(\"untokenizable\") && !allowed.contains(value)) throw new IllegalArgumentException(\"untokenizable must be one of \" + allowed);","typeGuard":null,"tryCatchPattern":"try { new PTBTokenizer<>(reader, factory, options); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"PTBLexer: Invalid option value\")) { throw new ConfigurationException(e); } throw e; }","preventionTips":["Only pass untokenizable values copied from UntokenizableOptions constants.","Validate option maps key-by-key before constructing the tokenizer.","Add a unit test that constructs the tokenizer with your production options string."],"tags":["tokenizer","configuration","enum"],"backgroundTag":"invalid-argument-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"}