{"record":{"id":"67054bb82b7275b6","repo":"karatelabs/karate","slug":"invalid-log-replay-mode-expected-one-of-off-failed-all","errorCode":null,"errorMessage":"invalid log replay mode: '', expected one of: off, failed, all","messagePattern":"invalid log replay mode: '', expected one of: off, failed, all","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"karate-gatling/src/main/java/io/karatelabs/gatling/KarateLogReplay.java","lineNumber":63,"sourceCode":"     * Replay the output of the features that already passed for this virtual user as well, oldest\n     * first, then the failing one. Retention is bounded by\n     * {@link KarateProtocolBuilder#logReplayLimit(int)} and is cleared after every replay.\n     */\n    ALL;\n\n    /**\n     * Parse a mode by name, case-insensitively.\n     *\n     * @throws IllegalArgumentException if the name is not one of {@code off}, {@code failed}, {@code all}\n     */\n    public static KarateLogReplay fromString(String value) {\n        if (value == null) {\n            return OFF;\n        }\n        try {\n            return valueOf(value.trim().toUpperCase(java.util.Locale.ROOT));\n        } catch (IllegalArgumentException e) {\n            throw new IllegalArgumentException(\"invalid log replay mode: '\" + value\n                    + \"', expected one of: off, failed, all\");\n        }\n    }\n}\n","sourceCodeStart":45,"sourceCodeEnd":68,"githubUrl":"https://github.com/karatelabs/karate/blob/a22eb90246d958d15a47bf436693d0121ad2812d/karate-gatling/src/main/java/io/karatelabs/gatling/KarateLogReplay.java#L45-L68","documentation":"KarateLogReplay.fromString(value) parses a log replay mode string into the OFF/FAILED/ALL enum. Any string that does not case-insensitively match one of off, failed, all throws IllegalArgumentException naming the offending value and the valid options. Null maps to OFF rather than throwing.","triggerScenarios":"Calling KarateLogReplay.fromString with a mistyped or unsupported mode, e.g. fromString(\"\"), fromString(\"on\"), fromString(\"faild\"), or from config/properties holding a wrong value.","commonSituations":"Setting karate logReplay mode via system property with a typo; assuming an 'on'/'off' boolean style works; trailing whitespace or quotes from YAML/properties parsing (trim is applied, but invalid words still fail).","solutions":["Use one of the exact words, case-insensitive: \"off\", \"failed\", or \"all\"","Fix the property/config value feeding fromString and re-run","Default is OFF — remove the setting entirely if you do not want replay"],"exampleFix":"// before\nKarateLogReplay mode = KarateLogReplay.fromString(System.getProperty(\"replay\", \"on\"));\n// after\nKarateLogReplay mode = KarateLogReplay.fromString(System.getProperty(\"replay\", \"failed\"));","handlingStrategy":"validation","validationCode":"String v = System.getProperty(\"replay\", \"off\").trim().toLowerCase();\nif (!v.equals(\"off\") && !v.equals(\"failed\") && !v.equals(\"all\")) { throw new IllegalArgumentException(\"replay mode must be off|failed|all\"); }","typeGuard":null,"tryCatchPattern":"try {\n  mode = KarateLogReplay.fromString(raw);\n} catch (IllegalArgumentException e) {\n  mode = KarateLogReplay.OFF; // or rethrow with context\n}","preventionTips":["Only use the literals off/failed/all (case-insensitive) in config","Rely on null -> OFF default instead of passing empty strings","Document valid values next to the config key"],"tags":["gatling","karate","enum","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"}