stanfordnlp/CoreNLP · error · IllegalStateException
Unknown Redwood flag for slf4j integration:
Error message
Unknown Redwood flag for slf4j integration:
What it means
SLF4JHandler.print() maps the target flag (loggerAndLevel.second) to an SLF4J logger level call; a value outside the known set (not FORCE/STDOUT/STDERR etc.) throws this IllegalStateException, so unknown/unsupported Redwood flags are rejected.
Solutions
- Only use SLF4JHandler via supported factory/configuration paths (Handlers.slf4j, documented constructors).
- Log/inspect the offending flag value in the message and map it to a supported one.
- Ensure all Redwood jars on the classpath are the same version to avoid mismatched flag enums.
- Route unknown targets through Handlers.output instead.
Defensive patterns
Strategy: try-catch
Try / catch
try {
config.handlers(Handlers.slf4j).apply();
} catch (IllegalStateException e) {
if (e.getMessage().startsWith("Unknown Redwood flag for slf4j integration:")) {
log.error("Unrecognized SLF4JHandler target flag; check jar versions", e);
RedwoodConfiguration.empty().handlers(Handlers.output).apply();
} else throw e;
} Prevention
- Never pass arbitrary flag values into SLF4JHandler targets from custom code.
- Ensure enum/flag classes are from a single consistent library version.
- Log the offending flag value from the exception message to identify the bad source.
When it happens
Trigger: An SLF4JHandler constructed or configured with a target flag value not recognized by its switch — typically from custom code or a modified handler passing an arbitrary Object as the level/target.
Common situations: Custom integrations feeding SLF4JHandler with bespoke flags; mismatched library versions where a new flag was added to one class but not the other; reflection-based manipulation of handler internals.
Understand the failure class
Background: "unknown output mode", "invalid value for flag", "expects true/false": fixing invalid flag value errors in CLI tools — this error's family across 24 libraries.
Related errors
- Could not find SLF4J in your classpath
- Should not reach this switch case
- Unknown collapse mode (Redwood):
- Unknown value for log.method
- Bad process cp1252
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/dd8ea126d762415e.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/util/logging/SLF4JHandler.java:93
// Route the signal
switch (loggerAndLevel.second) {
case ERROR:
loggerAndLevel.first.error(line);
break;
case WARN:
loggerAndLevel.first.warn(line);
break;
case DEBUG:
loggerAndLevel.first.debug(line);
break;
case STDOUT:
case STDERR:
loggerAndLevel.first.info(line);
break;
case FORCE:
throw new IllegalStateException("Should not reach this switch case");
default:
throw new IllegalStateException("Unknown Redwood flag for slf4j integration: " + loggerAndLevel.second);
}
}
}
View on GitHub (pinned to 1b7edd19c4)