{"record":{"id":"dd8ea126d762415e","repo":"stanfordnlp/CoreNLP","slug":"unknown-redwood-flag-for-slf4j-integration","errorCode":null,"errorMessage":"Unknown Redwood flag for slf4j integration: ","messagePattern":"Unknown Redwood flag for slf4j integration: ","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/util/logging/SLF4JHandler.java","lineNumber":93,"sourceCode":"    // Route the signal\n    switch (loggerAndLevel.second) {\n      case ERROR:\n        loggerAndLevel.first.error(line);\n        break;\n      case WARN:\n        loggerAndLevel.first.warn(line);\n        break;\n      case DEBUG:\n        loggerAndLevel.first.debug(line);\n        break;\n      case STDOUT:\n      case STDERR:\n        loggerAndLevel.first.info(line);\n        break;\n      case FORCE:\n        throw new IllegalStateException(\"Should not reach this switch case\");\n      default:\n        throw new IllegalStateException(\"Unknown Redwood flag for slf4j integration: \" + loggerAndLevel.second);\n    }\n  }\n\n}\n","sourceCodeStart":75,"sourceCodeEnd":98,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/util/logging/SLF4JHandler.java#L75-L98","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  config.handlers(Handlers.slf4j).apply();\n} catch (IllegalStateException e) {\n  if (e.getMessage().startsWith(\"Unknown Redwood flag for slf4j integration:\")) {\n    log.error(\"Unrecognized SLF4JHandler target flag; check jar versions\", e);\n    RedwoodConfiguration.empty().handlers(Handlers.output).apply();\n  } else throw e;\n}","preventionTips":["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."],"tags":["logging","slf4j","illegal-argument","flag"],"backgroundTag":"invalid-flag-value","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}