{"record":{"id":"ce1eb097d533452d","repo":"stanfordnlp/CoreNLP","slug":"not-a-valid-dashes-style-ce1eb0","errorCode":null,"errorMessage":"Not a valid dashes style: ","messagePattern":"Not a valid dashes style: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/process/PTBLexer.flex","lineNumber":216,"sourceCode":"              throw new IllegalArgumentException (\"Not a valid quotes style: \" + value);\n            }\n          } else if (\"splitAssimilations\".equals(key)) {\n            splitAssimilations = val;\n          } else if (\"splitHyphenated\".equals(key)) {\n            splitHyphenated = val;\n          } else if (\"splitForwardSlash\".equals(key)) {\n            splitForwardSlash = val;\n          } else if (\"ellipses\".equals(key)) {\n            try {\n              ellipsisStyle = LexerUtils.EllipsesEnum.valueOf(value.trim().toUpperCase(Locale.ROOT));\n            } catch (IllegalArgumentException iae) {\n              throw new IllegalArgumentException (\"Not a valid ellipses style: \" + value);\n            }\n          } else if (\"dashes\".equals(key)) {\n            try {\n              dashesStyle = LexerUtils.DashesEnum.valueOf(value.trim().toUpperCase(Locale.ROOT));\n            } catch (IllegalArgumentException iae) {\n              throw new IllegalArgumentException (\"Not a valid dashes style: \" + value);\n            }\n          } else if (\"escapeForwardSlashAsterisk\".equals(key)) {\n            escapeForwardSlashAsterisk = val;\n          } else if (\"untokenizable\".equals(key)) {\n            switch (value) {\n              case \"noneDelete\":\n                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\":","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/process/PTBLexer.flex#L198-L234","documentation":"PTBLexer options parsing rejects an unknown value for the 'dashes' option. The value string is converted to a LexerUtils.DashesEnum constant via valueOf; if it does not name a valid enum constant, an IllegalArgumentException is thrown. This guards against silent misconfiguration of dash tokenization behavior.","triggerScenarios":"Calling PTBLexer (or PTBTokenizer with options) with 'dashes' set to a string that is not a DashesEnum name, e.g. options string 'dashes=hyphens' or 'dashes=emdash' (valid values are typically 'none', 'ptb3', 'unicode').","commonSituations":"Copy-pasting tokenizer options from old documentation or blog posts; typos in the option value; assuming free-text dash styles are accepted; migrating configs between CoreNLP versions where enum names changed.","solutions":["Use a valid DashesEnum value (e.g. 'none', 'ptb3', 'unicode') in the options string","Check LexerUtils.DashesEnum for the exact accepted constants and their spellings","Trim/case-insensitively normalize the value before passing (valueOf already uppercases, so spelling matters more than case)"],"exampleFix":"// before\nPTBTokenizer coreLabelTokenizer = new PTBTokenizer<>(reader, \"dashes=hyphens\", false);\n// after\nPTBTokenizer coreLabelTokenizer = new PTBTokenizer<>(reader, \"dashes=ptb3\", false);","handlingStrategy":"validation","validationCode":"Set<String> valid = Arrays.stream(LexerUtils.DashesEnum.values()).map(Enum::name).collect(Collectors.toSet());\nif (!valid.contains(value.trim().toUpperCase(Locale.ROOT))) throw new IllegalArgumentException(\"bad dashes option: \" + value);","typeGuard":null,"tryCatchPattern":"try {\n  tokenizer = new PTBTokenizer<>(reader, factory, options);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"Not a valid dashes style\")) { /* fallback to default 'dashes=ptb3' or surface config error */ }\n  throw e;\n}","preventionTips":["Keep option values in constants/enums, never hand-typed strings","Unit-test your options strings at startup rather than at runtime","Match enum spelling exactly (valueOf is case-normalized but not typo-tolerant)"],"tags":["tokenization","options","illegal-argument"],"backgroundTag":"invalid-enum-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"}