{"record":{"id":"0253bdf41b8c384b","repo":"stanfordnlp/CoreNLP","slug":"not-a-valid-dashes-style-value","errorCode":null,"errorMessage":"Not a valid dashes style: ${value}","messagePattern":"Not a valid dashes style: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/international/spanish/process/SpanishLexer.java","lineNumber":14158,"sourceCode":"          } else if (\"normalizeAmpersandEntity\".equals(key)) {\n            normalizeAmpersandEntity = val;\n          } else if (\"normalizeFractions\".equals(key)) {\n            normalizeFractions = val;\n          } else if (\"normalizeParentheses\".equals(key)) {\n            normalizeParentheses = val;\n          } else if (\"normalizeOtherBrackets\".equals(key)) {\n            normalizeOtherBrackets = 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":14140,"sourceCodeEnd":14176,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/international/spanish/process/SpanishLexer.java#L14140-L14176","documentation":"SpanishLexer's constructor accepts a 'dashes' option controlling how dash characters are tokenized, mapped to LexerUtils.DashesEnum via Enum.valueOf. Any value that is not a valid DashesEnum constant (after trim/uppercase) causes this IllegalArgumentException naming the offending value.","triggerScenarios":"Constructing SpanishLexer with options 'dashes=<value>' where value is not a DashesEnum name (e.g. 'hyphen', 'em-dash', '', or an alias removed in the current version).","commonSituations":"Reusing PTBTokenizer 'dashes' settings that differ; hand-edited tokenizer properties files; migrating between CoreNLP versions where enum constant names changed; whitespace/encoding artifacts in the value string (leading/trailing chars are trimmed, but inner junk is not).","solutions":["Set a valid DashesEnum value such as 'dashes=unicode', 'dashes=delete', or 'dashes=leave' (match LexerUtils.DashesEnum for your version).","Inspect LexerUtils.DashesEnum to confirm accepted constants in the version in use.","Pre-validate the value in config loading code and reject bad tokens early.","Catch IllegalArgumentException around lexer construction and log the offending key/value."],"exampleFix":"// before\nnew SpanishLexer(reader, \"dashes=em-dash\");\n// after\nnew SpanishLexer(reader, \"dashes=unicode\");","handlingStrategy":"validation","validationCode":"String v = value.trim().toUpperCase(Locale.ROOT);\nboolean ok = java.util.Arrays.stream(LexerUtils.DashesEnum.values())\n    .anyMatch(e -> e.name().equals(v));\nif (!ok) throw new IllegalArgumentException(\"Bad dashes option: \" + value);","typeGuard":"static boolean isValidDashesStyle(String value) {\n  if (value == null) return false;\n  String v = value.trim().toUpperCase(Locale.ROOT);\n  for (LexerUtils.DashesEnum e : LexerUtils.DashesEnum.values())\n    if (e.name().equals(v)) return true;\n  return false;\n}","tryCatchPattern":"try {\n  lexer = new SpanishLexer(reader, options);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"Not a valid dashes style\")) {\n    lexer = new SpanishLexer(reader, options.replaceAll(\"dashes=[^,]*\", \"dashes=unicode\"));\n  } else { throw e; }\n}","preventionTips":["Mirror PTBTokenizer dash-option names exactly when copying configs.","Validate all lexer options in one pass before construction.","Avoid building option strings by fragile string concatenation."],"tags":["java","stanford-nlp","tokenizer","configuration","lexer"],"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-15T23:17:13.987Z"}