{"record":{"id":"3968ab4375c41864","repo":"apache/maven","slug":"unknown-cache-scope-using-default-request-sco","errorCode":null,"errorMessage":"Unknown cache scope: {}, using default REQUEST_SCOPED","messagePattern":"Unknown cache scope: (.+?), using default REQUEST_SCOPED","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"impl/maven-impl/src/main/java/org/apache/maven/impl/cache/CacheSelectorParser.java","lineNumber":140,"sourceCode":"                    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);\n                yield CacheRetention.REQUEST_SCOPED;\n            }\n        };\n    }\n\n    /**\n     * Parses a reference type string into Cache.ReferenceType.\n     */\n    private static Cache.ReferenceType parseReferenceType(String value) {\n        return switch (value.toLowerCase(Locale.ENGLISH)) {\n            case \"soft\" -> Cache.ReferenceType.SOFT;\n            case \"hard\" -> Cache.ReferenceType.HARD;\n            case \"weak\" -> Cache.ReferenceType.WEAK;\n            case \"none\" -> Cache.ReferenceType.NONE;\n            default -> {\n                LOGGER.warn(\"Unknown reference type: {}, using default SOFT\", value);\n                yield Cache.ReferenceType.SOFT;\n            }","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-impl/src/main/java/org/apache/maven/impl/cache/CacheSelectorParser.java#L122-L158","documentation":"The 'scope' key of a cache selector configuration was parsed and its value (lower-cased) matched none of session, request, persistent, disabled, or none. CacheSelectorParser.parseScope() logs the raw value and yields the default CacheRetention.REQUEST_SCOPED, so the cache for that selector is request-scoped regardless of what was intended. The build continues; only cache retention differs from the requested one.","triggerScenarios":"-Dmaven.cache.config=<selector>{scope=<bad>} with <bad> e.g. 'global', 'jvm', 'application', 'singleton', or a trailing-space variant that survives trim (none: trim happens before parse, so plain typos are the usual case).","commonSituations":"Users expecting a cross-build ('persistent') cache typing scope=global; migration from another build tool's cache terminology; sharing config snippets between machines with different Maven versions where the scope vocabulary changed.","solutions":["Use one of the accepted scope values: session, request, persistent, or disabled/none","If you wanted caching to survive the build, use scope=persistent","Re-run and confirm the warning is gone, otherwise your selector block may also contain unknown keys (see the unknown-property warning)"],"exampleFix":"# before\nmvn clean install '-Dmaven.cache.config=**{scope=global}'\n\n# after\nmvn clean install '-Dmaven.cache.config=**{scope=persistent}'","handlingStrategy":"validation","validationCode":"// Mirror the parser's vocabulary and reject invalid scope values up front\nstatic final Set<String> VALID_SCOPES =\n        Set.of(\"session\", \"request\", \"persistent\", \"disabled\", \"none\");\nString scope = kv.get(\"scope\");\nif (scope != null && !VALID_SCOPES.contains(scope.trim().toLowerCase(Locale.ROOT))) {\n    throw new IllegalArgumentException(\n        \"cache scope must be session|request|persistent|disabled|none, got: \" + scope);\n}","typeGuard":"Optional<CacheRetention> asCacheScope(String s) {\n    if (s == null) return Optional.empty();\n    return switch (s.trim().toLowerCase(Locale.ROOT)) {\n        case \"session\" -> Optional.of(CacheRetention.SESSION_SCOPED);\n        case \"request\" -> Optional.of(CacheRetention.REQUEST_SCOPED);\n        case \"persistent\" -> Optional.of(CacheRetention.PERSISTENT);\n        case \"disabled\", \"none\" -> Optional.of(CacheRetention.DISABLED);\n        default -> Optional.empty();\n    };\n}","tryCatchPattern":null,"preventionTips":["Remember the scope vocabulary is session/request/persistent/disabled (plus 'none' alias), not global/jvm","Validate the whole -Dmaven.cache.config string in a repo lint script before CI runs","Prefer omitting scope (defaults to request) unless a specific retention is measured to help"],"tags":["maven","cache-configuration","scope","config-parsing"],"backgroundTag":"invalid-configuration-value","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}