{"record":{"id":"0efc9864afcfd524","repo":"apache/beam","slug":"unsupported-log-level-s-requested-for-s-must-be-one-of-s","errorCode":null,"errorMessage":"Unsupported log level '%s' requested for %s. Must be one of %s.","messagePattern":"Unsupported log level '(.+?)' requested for (.+?)\\. Must be one of (.+?)\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/options/SdkHarnessOptions.java","lineNumber":352,"sourceCode":"     * {@code Name} generally represents the fully qualified Java {@link Class#getName() class\n     * name}, or fully qualified Java {@link Package#getName() package name}, or custom logger name.\n     * The {@code LogLevel} represents the log level and must be one of {@link LogLevel}.\n     */\n    @JsonCreator(mode = JsonCreator.Mode.DELEGATING)\n    public static SdkHarnessLogLevelOverrides from(Map<String, String> values) {\n      checkArgumentNotNull(values, \"Expected values to be not null.\");\n      SdkHarnessLogLevelOverrides overrides = new SdkHarnessLogLevelOverrides();\n      for (Map.Entry<String, String> entry : values.entrySet()) {\n        String module = entry.getKey();\n        String level = entry.getValue();\n        if (level.equals(\"WARNING\")) {\n          // alias: \"WARNING\" -> \"WARN\"\n          level = \"WARN\";\n        }\n        try {\n          overrides.addOverrideForName(module, LogLevel.valueOf(level));\n        } catch (IllegalArgumentException e) {\n          throw new IllegalArgumentException(\n              String.format(\n                  \"Unsupported log level '%s' requested for %s. Must be one of %s.\",\n                  level, module, Arrays.toString(LogLevel.values())));\n        }\n      }\n      return overrides;\n    }\n  }\n\n  /**\n   * Open modules needed for reflection that access JDK internals with Java 9+.\n   *\n   * <p>With JDK 16+, <a href=\"#{https://openjdk.java.net/jeps/403}\">JDK internals are strongly\n   * encapsulated</a> and can result in an InaccessibleObjectException being thrown if a tool or\n   * library uses reflection that access JDK internals. If you see these errors in your worker logs,\n   * you can pass in modules to open using the format {@code\n   * module/package=target-module[,module2/package2=another-target-module]} to allow access to the\n   * library. E.g. {@code --jdkAddOpenModules=java.base/java.lang=jamm}. This will set {@code","sourceCodeStart":334,"sourceCodeEnd":370,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/options/SdkHarnessOptions.java#L334-L370","documentation":"SdkHarnessOptions.LogOverrides.from parses a requested log level per module and maps it to the LogLevel enum. This IllegalArgumentException is thrown when the level string is not a valid LogLevel enum constant (only \"WARNING\" has a special alias to \"WARN\"), and the message lists the supported values.","triggerScenarios":"Calling SdkHarnessOptions.LogOverrides.from(...) with a map containing a level like \"error\", \"severe\", \"ERROR\", \"FATAL\", or any spelling not exactly matching a LogLevel value.","commonSituations":"Config files using SLF4J or JUL-style level names (e.g. \"ERROR\") that don't match Beam's enum, casing differences, or renamed levels across Beam versions.","solutions":["Use one of the exact LogLevel values (see the message's list, e.g. DEBUG, INFO, WARN, ERROR)","Change \"WARNING\"-style spellings: \"WARNING\" is aliased to \"WARN\" but \"ERROR\" vs \"ERR\" etc. must match the enum exactly","Normalize/uppercase the level string and validate against LogLevel.values() before calling from()"],"exampleFix":"// before\nLogOverrides.from(ImmutableMap.of(\"org.apache.beam\", \"ERROR\")); // if ERROR not in enum\n// after\nLogOverrides.from(ImmutableMap.of(\"org.apache.beam\", \"WARN\")); // exact LogLevel value","handlingStrategy":"validation","validationCode":"String lvl = requested.trim().toUpperCase();\nif (!lvl.equals(\"WARNING\")) {\n  try { LogLevel.valueOf(lvl); } catch (IllegalArgumentException e) { throw new IllegalArgumentException(\"Bad log level \" + requested + \"; use \" + Arrays.toString(LogLevel.values())); }\n}","typeGuard":"boolean isValidLogLevel(String s) { return \"WARNING\".equalsIgnoreCase(s) || Arrays.stream(LogLevel.values()).anyMatch(l -> l.name().equalsIgnoreCase(s)); }","tryCatchPattern":"try { overrides.addOverrideForName(module, LogLevel.valueOf(level)); } catch (IllegalArgumentException e) { /* fall back to INFO and log a warning */ }","preventionTips":["Uppercase and trim log level strings from config files before mapping","Keep a name->LogLevel alias map (ERROR->WARN etc.) instead of raw valueOf","Pin log level names to Beam's enum when upgrading Beam versions"],"tags":["java","apache-beam","logging","log-level"],"backgroundTag":"invalid-enum-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}