{"record":{"id":"43ca68fb86e28be3","repo":"karatelabs/karate","slug":"configure-logging-mask-unknown-key-known","errorCode":null,"errorMessage":"configure logging.mask: unknown key '{}' (known: {})","messagePattern":"configure logging\\.mask: unknown key '(.+?)' \\(known: (.+?)\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"karate-core/src/main/java/io/karatelabs/output/LogMask.java","lineNumber":87,"sourceCode":"                    List<String> jsonPaths,\n                    List<PatternRule> patternRules,\n                    String replacement,\n                    JavaCallable enableForUri) {\n        this.maskedHeadersLower = maskedHeadersLower;\n        this.jsonPaths = jsonPaths;\n        this.patternRules = patternRules;\n        this.replacement = replacement;\n        this.enableForUri = enableForUri;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    public static LogMask fromMap(Map<String, Object> map) {\n        if (map == null || map.isEmpty()) {\n            return null;\n        }\n        for (String key : map.keySet()) {\n            if (!KNOWN_KEYS.contains(key)) {\n                logger.warn(\"configure logging.mask: unknown key '{}' (known: {})\", key, KNOWN_KEYS);\n            }\n        }\n        String replacement = map.get(\"replacement\") instanceof String s ? s : DEFAULT_REPLACEMENT;\n        Set<String> headers = new LinkedHashSet<>();\n        if (map.get(\"headers\") instanceof List<?> list) {\n            for (Object item : list) {\n                if (item != null) {\n                    headers.add(item.toString().toLowerCase());\n                }\n            }\n        }\n        List<String> jsonPaths = new ArrayList<>();\n        if (map.get(\"jsonPaths\") instanceof List<?> list) {\n            for (Object item : list) {\n                if (item != null) {\n                    jsonPaths.add(item.toString());\n                }\n            }","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/karatelabs/karate/blob/a22eb90246d958d15a47bf436693d0121ad2812d/karate-core/src/main/java/io/karatelabs/output/LogMask.java#L69-L105","documentation":"LogMask.fromMap() validates the keys of the configure logging.mask map against KNOWN_KEYS. Unknown keys do not abort configuration — each is warned about with the full list of known keys, and valid options (replacement, headers, etc.) are still applied. It indicates a typo or stale option in the mask configuration.","triggerScenarios":"Calling configure logging.mask (e.g. in karate-config.js or a Feature Background) with a map containing a key not in LogMask.KNOWN_KEYS — typically a misspelled option or one removed/renamed in a newer Karate version.","commonSituations":"Typo like 'replacment' or 'header'; copying config from an older tutorial using a renamed key; IDE autocomplete lacking for the JS-side map literal.","solutions":["Compare your keys against the known list printed in the warning and fix the typo","Remove keys that no longer exist in your Karate version (check the LogMask javadoc/changelog)","Keep only supported keys (replacement, headers, ...) in the logging.mask map","Add a startup assertion in CI that parses warnings to catch misconfiguration early"],"exampleFix":"// before\nkarate.configure('logging.mask', { replacment: '***', headers: ['Authorization'] });\n// after\nkarate.configure('logging.mask', { replacement: '***', headers: ['Authorization'] });","handlingStrategy":"validation","validationCode":"// JS: validate mask keys before configure\nconst known = ['replacement', 'headers'];\nconst mask = { replacement: '***', headers: ['Authorization'] };\nfor (const k of Object.keys(mask)) {\n  if (!known.includes(k)) throw new Error('unknown logging.mask key: ' + k);\n}\nkarate.configure('logging.mask', mask);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Copy logging.mask keys only from the current version's documentation","Treat this warning as a typo signal — unknown keys are silently ignored","Pin the Karate version and re-check mask options when upgrading"],"tags":["configuration","logging","masking","validation"],"backgroundTag":"invalid-config-value","analyzedSha":"a22eb90246d958d15a47bf436693d0121ad2812d","analyzedAt":"2026-09-12T09:01:00.220Z","contentChangedAt":"2026-09-12T09:01:00.220Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}