{"record":{"id":"2c6c6460cae2a6ee","repo":"stanfordnlp/CoreNLP","slug":"not-a-valid-newlineissentencebreak-name-name","errorCode":null,"errorMessage":"Not a valid NewlineIsSentenceBreak name: '${name}' (should be one of 'always', 'never', 'two')","messagePattern":"Not a valid NewlineIsSentenceBreak name: '(.+?)' \\(should be one of 'always', 'never', 'two'\\)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/process/WordToSentenceProcessor.java","lineNumber":147,"sourceCode":"\n  private final Pattern sentenceRegionEndPattern;\n\n  private final NewlineIsSentenceBreak newlineIsSentenceBreak;\n\n  private final boolean isOneSentence;\n\n  /** Whether to output empty sentences. */\n  private final boolean allowEmptySentences;\n\n  public static NewlineIsSentenceBreak stringToNewlineIsSentenceBreak(String name) {\n    if (\"always\".equals(name)) {\n      return NewlineIsSentenceBreak.ALWAYS;\n    } else if (\"never\".equals(name)) {\n      return NewlineIsSentenceBreak.NEVER;\n    } else if (name != null && name.contains(\"two\")) {\n      return NewlineIsSentenceBreak.TWO_CONSECUTIVE;\n    } else {\n      throw new IllegalArgumentException(\"Not a valid NewlineIsSentenceBreak name: '\" + name + \"' (should be one of 'always', 'never', 'two')\");\n    }\n  }\n\n  /** This is a sort of hacked in other way to end sentences.\n   *  Tokens with the ForcedSentenceEndAnnotation set to true\n   *  will also end a sentence.\n   */\n  @SuppressWarnings(\"OverlyStrongTypeCast\")\n  private static boolean isForcedEndToken(Object o) {\n    if (o instanceof CoreMap) {\n      Boolean forcedEndValue =\n              ((CoreMap)o).get(CoreAnnotations.ForcedSentenceEndAnnotation.class);\n      String originalText = ((CoreMap) o).get(CoreAnnotations.OriginalTextAnnotation.class);\n      return (forcedEndValue != null && forcedEndValue) ||\n          (originalText != null && originalText.equals(\"\\u2029\"));\n    } else {\n      return false;\n    }","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/process/WordToSentenceProcessor.java#L129-L165","documentation":"WordToSentenceProcessor.stringToNewlineIsSentenceBreak converts the option string into the NewlineIsSentenceBreak enum. Only 'always', 'never', or anything containing 'two' is accepted; any other (or null/empty) name throws IllegalArgumentException.","triggerScenarios":"Setting the ssplit.newlineIsSentenceBreak (or related) option to an unrecognized value such as 'true', 'yes', 'Always', or a misspelling when constructing WordToSentenceProcessor from properties.","commonSituations":"Typos in CoreNLP properties (ssplit.newlineIsSentenceBreak=true instead of always); case sensitivity mistakes; values copied from other tokenizers' docs.","solutions":["Set the option to exactly one of: always, never, two (or any string containing 'two', e.g. twoConsecutive)","Lowercase/normalize the value before passing it in","Remove the property to use the default (never) if newline breaks are not desired","Validate config values before building the processor"],"exampleFix":"// before\nprops.setProperty(\"ssplit.newlineIsSentenceBreak\", \"true\");\n// after\nprops.setProperty(\"ssplit.newlineIsSentenceBreak\", \"always\");","handlingStrategy":"validation","validationCode":"String v = opt == null ? null : opt.trim().toLowerCase();\nif (v != null && !v.equals(\"always\") && !v.equals(\"never\") && !v.contains(\"two\"))\n  throw new IllegalArgumentException(\"newlineIsSentenceBreak must be always|never|two\");","typeGuard":null,"tryCatchPattern":"try {\n  processor = new WordToSentenceProcessor<>(props);\n} catch (IllegalArgumentException e) {\n  props.setProperty(\"ssplit.newlineIsSentenceBreak\", \"never\");\n  processor = new WordToSentenceProcessor<>(props);\n}","preventionTips":["Use only the literal values always, never, two","Normalize case/whitespace on option values before passing properties","Do not reuse boolean-style values (true/false) for this enum option"],"tags":["java","config","enum","sentence-splitting"],"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-16T04:17:20.429Z"}