apache/cassandra · error · IllegalArgumentException
Options to normalize terms cannot be both uppercase and lowe
Error message
Options to normalize terms cannot be both uppercase and lowercase at the same time
What it means
NonTokenizingOptions.Builder.build() enforces that case-normalization is one-directional: lowerCaseOutput and upperCaseOutput cannot both be true. Setting both is contradictory, so the builder throws IllegalArgumentException before constructing the options object.
Source
Thrown at src/java/org/apache/cassandra/index/sasi/analyzer/NonTokenizingOptions.java:93
return this;
}
public OptionsBuilder upperCaseOutput(boolean upperCaseOutput)
{
this.upperCaseOutput = upperCaseOutput;
return this;
}
public OptionsBuilder lowerCaseOutput(boolean lowerCaseOutput)
{
this.lowerCaseOutput = lowerCaseOutput;
return this;
}
public NonTokenizingOptions build()
{
if (lowerCaseOutput && upperCaseOutput)
throw new IllegalArgumentException("Options to normalize terms cannot be " +
"both uppercase and lowercase at the same time");
NonTokenizingOptions options = new NonTokenizingOptions();
options.setCaseSensitive(caseSensitive);
options.setUpperCaseOutput(upperCaseOutput);
options.setLowerCaseOutput(lowerCaseOutput);
return options;
}
}
public static NonTokenizingOptions buildFromMap(Map<String, String> optionsMap)
{
OptionsBuilder optionsBuilder = new OptionsBuilder();
for (Map.Entry<String, String> entry : optionsMap.entrySet())
{
switch (entry.getKey())
{View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Set only one of lowercase/uppercase output to true
- Default: leave both false to keep original casing
- Guard the flags before building
Example fix
// before builder.setLowercaseOutput(true).setUppercaseOutput(true).build(); // after builder.setLowercaseOutput(true).setUppercaseOutput(false).build();
Defensive patterns
Strategy: validation
Validate before calling
if (lowerCaseOutput && upperCaseOutput) throw new IllegalArgumentException("Choose only one of lowercase/uppercase normalization"); Try / catch
try { NonTokenizingOptions opts = builder.build(); } catch (IllegalArgumentException e) { if (e.getMessage().contains("both uppercase and lowercase")) { builder.setUppercaseOutput(false); NonTokenizingOptions opts = builder.build(); } } Prevention
- Treat lowercase/uppercase normalization flags as mutually exclusive
- Use a single enum (NONE|LOWER|UPPER) in your own config layer
When it happens
Trigger: Calling new NonTokenizingOptions.Builder().setLowercaseOutput(true).setUppercaseOutput(true).build(), or building options from a map where both normalize_lowercase and normalize_uppercase are 'true'.
Common situations: Programmatically merging option maps where two sources each set a different normalization flag, or misreading the flags as independent booleans.
Related errors
- Options to normalize terms cannot be both uppercase and lowe
- case_sensitive option cannot be specified together with eith
- minTokenLength must be greater than zero
- maxTokenLength must be greater than zero
- Only one of %s, %s can be specified.
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/66fab0fef9380253.
Report an issue: GitHub.