{"record":{"id":"8ffe820febcc52bc","repo":"apache/maven","slug":"unknown-cache-configuration-property","errorCode":null,"errorMessage":"Unknown cache configuration property: {}","messagePattern":"Unknown cache configuration property: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"impl/maven-impl/src/main/java/org/apache/maven/impl/cache/CacheSelectorParser.java","lineNumber":122,"sourceCode":"    private static PartialCacheConfig parseProperties(String properties) {\n        CacheRetention scope = null;\n        Cache.ReferenceType referenceType = null;\n\n        Matcher propMatcher = PROPERTY_PATTERN.matcher(properties);\n        while (propMatcher.find()) {\n            String key = propMatcher.group(1);\n            String value = propMatcher.group(2);\n\n            switch (key.toLowerCase(Locale.ENGLISH)) {\n                case \"scope\":\n                    scope = parseScope(value);\n                    break;\n                case \"ref\":\n                case \"reference\":\n                    referenceType = parseReferenceType(value);\n                    break;\n                default:\n                    LOGGER.warn(\"Unknown cache configuration property: {}\", key);\n            }\n        }\n\n        // Return partial configuration (null values are allowed)\n        return new PartialCacheConfig(scope, referenceType);\n    }\n\n    /**\n     * Parses a scope string into CacheRetention.\n     */\n    private static CacheRetention parseScope(String value) {\n        return switch (value.toLowerCase(Locale.ENGLISH)) {\n            case \"session\" -> CacheRetention.SESSION_SCOPED;\n            case \"request\" -> CacheRetention.REQUEST_SCOPED;\n            case \"persistent\" -> CacheRetention.PERSISTENT;\n            case \"disabled\", \"none\" -> CacheRetention.DISABLED;\n            default -> {\n                LOGGER.warn(\"Unknown cache scope: {}, using default REQUEST_SCOPED\", value);","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-impl/src/main/java/org/apache/maven/impl/cache/CacheSelectorParser.java#L104-L140","documentation":"While parsing the selector configuration language for Maven's internal caches (-Dmaven.cache.config=...), CacheSelectorParser matched a key=value pair whose key is neither 'scope' nor 'ref'/'reference'. The unknown key is announced and otherwise ignored, producing a PartialCacheConfig with only the recognized keys set. It is a syntax-typo guard: recognized keys still take effect, so behavior silently diverges from what the user believes they configured.","triggerScenarios":"Writing -Dmaven.cache.config=<selector>{scope=session,refs=soft}: the key 'refs' (invalid) is skipped while 'scope' is honored. Any key other than scope/ref/reference hits the default branch of the switch.","commonSituations":"Guessing property names instead of consulting the cache configuration docs ('type=', 'ttl=', 'refs='); stale config from an older Maven where the key set differed; copy-paste between projects with divergent Maven versions.","solutions":["Restrict keys inside the curly-brace selector block to scope=..., ref=..., or reference=...","Remove the unknown key and re-run; the warning disappears when every key is recognized","Check the Maven cache configuration documentation for the current key set after upgrading Maven"],"exampleFix":"# before: 'refs' is not a recognized key, silently ignored\nmvn clean install '-Dmaven.cache.config=**{scope=session,refs=hard}'\n\n# after: recognized keys only\nmvn clean install '-Dmaven.cache.config=**{scope=session,reference=hard}'","handlingStrategy":"validation","validationCode":"# Validate the selector grammar before passing it to Maven\nimport re, sys\ncfg = sys.argv[1]  # e.g. '**{scope=session,reference=hard}'\nfor m in re.finditer(r'\\{([^}]*)\\}', cfg):\n    for kv in m.group(1).split(','):\n        key = kv.split('=')[0].strip().lower()\n        if key not in ('scope', 'ref', 'reference'):\n            sys.exit(f\"unknown cache config key '{key}' in {cfg}\")","typeGuard":"boolean isKnownCacheKey(String key) {\n    return switch (key.toLowerCase(Locale.ENGLISH)) {\n        case \"scope\", \"ref\", \"reference\" -> true;\n        default -> false;\n    };\n}","tryCatchPattern":null,"preventionTips":["Keep selector blocks limited to the documented keys scope, ref, reference","Copy cache config from the official docs rather than composing it from memory","After any cache config change, run one cheap build and confirm zero cache-configuration warnings"],"tags":["maven","cache-configuration","config-parsing","typo"],"backgroundTag":"unknown-config-key","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}