{"record":{"id":"ff36dc521ddac2e5","repo":"karatelabs/karate","slug":"invalid-log-replay-level-expected-one-of-trace-debug-info","errorCode":null,"errorMessage":"invalid log replay level: '', expected one of: trace, debug, info, warn, error","messagePattern":"invalid log replay level: '', expected one of: trace, debug, info, warn, error","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"karate-gatling/src/main/java/io/karatelabs/gatling/KarateProtocolBuilder.java","lineNumber":132,"sourceCode":"    }\n\n    /** {@link #logReplay(KarateLogReplay)} by name: {@code \"off\"}, {@code \"failed\"}, {@code \"all\"}. */\n    public KarateProtocolBuilder logReplay(String mode) {\n        return logReplay(KarateLogReplay.fromString(mode));\n    }\n\n    /**\n     * The level the replayed output is logged at, defaulting to {@code error} so it survives the\n     * quiet Logback config a load run usually has. Accepts {@code trace}, {@code debug},\n     * {@code info}, {@code warn}, {@code error}.\n     *\n     * @return this builder for chaining\n     */\n    public KarateProtocolBuilder logReplayLevel(String level) {\n        try {\n            this.logReplayLevel = LogLevel.valueOf(level.trim().toUpperCase(Locale.ROOT));\n        } catch (Exception e) {\n            throw new IllegalArgumentException(\"invalid log replay level: '\" + level\n                    + \"', expected one of: trace, debug, info, warn, error\");\n        }\n        return this;\n    }\n\n    /**\n     * How many already-passed feature logs to retain per virtual user in\n     * {@link KarateLogReplay#ALL} mode, defaulting to {@value LogReplayer#DEFAULT_LIMIT}. This text\n     * is held in memory for every virtual user until it is replayed or dropped, so raise it with\n     * the run's concurrency in mind. Once a replay happens the retained logs are cleared, which is\n     * what keeps the window to the current iteration in the common case — Gatling gives an action\n     * no iteration boundary to hook, so the guarantee is \"the last N Karate calls for this user\".\n     *\n     * @return this builder for chaining\n     */\n    public KarateProtocolBuilder logReplayLimit(int limit) {\n        if (limit < 1) {\n            // zero would retain nothing AND report nothing dropped, quietly turning ALL into","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/karatelabs/karate/blob/a22eb90246d958d15a47bf436693d0121ad2812d/karate-gatling/src/main/java/io/karatelabs/gatling/KarateProtocolBuilder.java#L114-L150","documentation":"KarateProtocolBuilder.logReplayLevel(String) maps a string to the LogLevel enum (trace, debug, info, warn, error). Any null, empty, or unrecognized level throws IllegalArgumentException listing the valid values. This controls which log lines are retained/replayed in Gatling reports.","triggerScenarios":"Calling logReplayLevel(\"\") or logReplayLevel(\"verbose\") / any misspelled level; passing a level sourced from an unset config property; passing a non-LogLevel-compatible name like 'warning' or 'err'.","commonSituations":"Configuration strings using log4j-style names ('warn' ok, 'warning' not); empty string from a properties file placeholder; renamed constants between library versions.","solutions":["Pass one of: \"trace\", \"debug\", \"info\", \"warn\", \"error\" (case-insensitive)","Fix the config value feeding logReplayLevel; guard with a default: level.isEmpty() ? \"error\" : level","If you wanted to disable replay entirely, use logReplay(OFF) instead of changing the level"],"exampleFix":"// before\nprotocol.logReplayLevel(System.getProperty(\"log.level\", \"\"));\n// after\nprotocol.logReplayLevel(System.getProperty(\"log.level\", \"error\"));","handlingStrategy":"validation","validationCode":"String l = level == null ? \"error\" : level.trim().toLowerCase();\nif (!List.of(\"trace\",\"debug\",\"info\",\"warn\",\"error\").contains(l)) { throw new IllegalArgumentException(\"log level must be trace|debug|info|warn|error\"); }","typeGuard":null,"tryCatchPattern":"try {\n  protocol.logReplayLevel(level);\n} catch (IllegalArgumentException e) {\n  protocol.logReplayLevel(\"error\");\n}","preventionTips":["Use exactly trace/debug/info/warn/error — not 'warning' or 'err'","Never pass an empty string from a properties placeholder; default it","Prefer the LogLevel enum overload if available"],"tags":["gatling","karate","enum","logging","configuration"],"backgroundTag":"invalid-enum-value","analyzedSha":"a22eb90246d958d15a47bf436693d0121ad2812d","analyzedAt":"2026-09-12T09:01:00.220Z","contentChangedAt":"2026-09-12T09:01:00.220Z","schemaVersion":2},"datasetVersion":"2026-09-16T19:17:19.609Z"}