stanfordnlp/CoreNLP · error · IllegalArgumentException
Unknown collapse mode (Redwood):
Error message
Unknown collapse mode (Redwood):
What it means
RedwoodConfiguration.parse() interprets the 'log.collpse'/'collapse' property via RepeatedRecordHandler modes. Only exact, approximate, and none are accepted; anything else throws this IllegalArgumentException.
Solutions
- Set collapse to one of: exact, approximate, or none.
- Remove the collapse property entirely to use the default behavior.
- Check case-insensitive spelling of the value.
- If unsure what modes do, use 'exact' (identical repeated records collapsed) or 'none' (no collapsing).
Example fix
// before
props.setProperty("log.collapse", "true");
// after
props.setProperty("log.collapse", "exact"); // or approximate / none Defensive patterns
Strategy: validation
Validate before calling
String collapse = props.getProperty("log.collapse", "none");
if (!("exact".equalsIgnoreCase(collapse) || "approximate".equalsIgnoreCase(collapse) || "none".equalsIgnoreCase(collapse))) {
throw new IllegalArgumentException("log.collapse must be exact, approximate, or none: " + collapse);
} Try / catch
try {
RedwoodConfiguration.applyProperties(props);
} catch (IllegalArgumentException e) {
if (e.getMessage().startsWith("Unknown collapse mode")) {
System.err.println("Bad log.collapse value; using 'none'");
props.setProperty("log.collapse", "none");
RedwoodConfiguration.applyProperties(props);
} else throw e;
} Prevention
- Only use the literals exact/approximate/none for collapse settings.
- Do not treat collapse as a boolean flag; use 'none' to disable.
- Validate config values centrally before handing Properties to Redwood.
When it happens
Trigger: Applying properties where the collapse setting (log.collapse, e.g. "true", "repeated", "compact") is not one of exact/approximate/none (comparison is case-insensitive).
Common situations: Copy-pasting collapse settings from other frameworks; guessing boolean-like values (true/false) thinking collapse is a flag; typos such as 'excat' or 'aproximate'.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Unknown value for log.method
- Unknown LogPriorType:
- Unsupported subScoreType
- Unknown clique: " + clique
- Unknown prior type:
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/32f1c68c04d77698.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/util/logging/RedwoodConfiguration.java:591
if(get(props,"log.captureStreams","false",used).equalsIgnoreCase("true")){
config = config.capture(System.out).capture(System.err);
}
if(get(props,"log.captureStdout","false",used).equalsIgnoreCase("true")){
config = config.capture(System.out);
}
if(get(props,"log.captureStderr","false",used).equalsIgnoreCase("true")){
config = config.capture(System.err);
}
//--Collapse
String collapse = get(props, "log.collapse", "none", used);
List<LogRecordHandler> chain = new LinkedList<>();
if (collapse.equalsIgnoreCase("exact")) {
chain.add(new RepeatedRecordHandler(RepeatedRecordHandler.EXACT));
} else if (collapse.equalsIgnoreCase("approximate")) {
chain.add(new RepeatedRecordHandler(RepeatedRecordHandler.APPROXIMATE));
} else if (!collapse.equalsIgnoreCase("none")) {
throw new IllegalArgumentException("Unknown collapse mode (Redwood): " + collapse);
}
//--Channels.Debug
boolean debug = Boolean.parseBoolean(get(props, "log.channels.debug", "true", used));
if (!debug) {
chain.add(Handlers.hideDebug);
}
//--Channels.Width
config.channelWidth( Integer.parseInt(get(props, "log.channels.width", "0", used)) );
//--Neat exit
if(get(props,"log.neatExit","false",used).equalsIgnoreCase("true")){
config = config.neatExit();
}
//--File
String outputFile = get(props, "log.file", null, used);View on GitHub (pinned to 1b7edd19c4)