{"record":{"id":"65f645a534c050e9","repo":"apache/maven","slug":"unknown-reference-type-using-default-soft","errorCode":null,"errorMessage":"Unknown reference type: {}, using default SOFT","messagePattern":"Unknown reference type: (.+?), using default SOFT","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"impl/maven-impl/src/main/java/org/apache/maven/impl/cache/CacheSelectorParser.java","lineNumber":156,"sourceCode":"            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            }\n        };\n    }\n\n    /**\n     * Compares specificity of two selectors. More specific selectors should be checked first.\n     * Specificity order: parent + request > request only > wildcard\n     */\n    private static int compareSpecificity(CacheSelector a, CacheSelector b) {\n        int aScore = getSpecificityScore(a);\n        int bScore = getSpecificityScore(b);\n        return Integer.compare(aScore, bScore);\n    }\n\n    private static int getSpecificityScore(CacheSelector selector) {\n        int score = 0;\n","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-impl/src/main/java/org/apache/maven/impl/cache/CacheSelectorParser.java#L138-L174","documentation":"The 'ref'/'reference' key of a cache selector configuration was parsed and its value (lower-cased) matched none of soft, hard, weak, or none. parseReferenceType() logs the value and yields the default Cache.ReferenceType.SOFT, so cache entries keep soft references even though a different strategy was requested. Behavior remains correct but memory/GC characteristics differ from the intent.","triggerScenarios":"-Dmaven.cache.config=<selector>{ref=<bad>} where <bad> is e.g. 'strong', 'string', 'ghost', or the enum name in the wrong case for an unsupported alias.","commonSituations":"GC terminology mix-ups (strong vs hard, phantom vs weak); autocompleted key names in editor configs; values valid for a different cache library pasted into maven.cache.config.","solutions":["Use one of the accepted reference values: soft, hard, weak, or none","If you wanted entries pinned for the whole build, use reference=hard","Verify the whole selector string parses cleanly by checking that no cache-configuration warnings remain in the log"],"exampleFix":"# before\nmvn clean install '-Dmaven.cache.config=**{scope=session,ref=strong}'\n\n# after\nmvn clean install '-Dmaven.cache.config=**{scope=session,ref=hard}'","handlingStrategy":"validation","validationCode":"static final Set<String> VALID_REFS = Set.of(\"soft\", \"hard\", \"weak\", \"none\");\nString ref = kv.get(\"reference\") != null ? kv.get(\"reference\") : kv.get(\"ref\");\nif (ref != null && !VALID_REFS.contains(ref.trim().toLowerCase(Locale.ROOT))) {\n    throw new IllegalArgumentException(\"reference must be soft|hard|weak|none, got: \" + ref);\n}","typeGuard":"Optional<Cache.ReferenceType> asRefType(String s) {\n    if (s == null) return Optional.empty();\n    return switch (s.trim().toLowerCase(Locale.ROOT)) {\n        case \"soft\" -> Optional.of(Cache.ReferenceType.SOFT);\n        case \"hard\" -> Optional.of(Cache.ReferenceType.HARD);\n        case \"weak\" -> Optional.of(Cache.ReferenceType.WEAK);\n        case \"none\" -> Optional.of(Cache.ReferenceType.NONE);\n        default -> Optional.empty();\n    };\n}","tryCatchPattern":null,"preventionTips":["Use only soft/hard/weak/none; 'strong' and 'phantom' are not valid here","Keep the key (ref/reference) and value spelling in one reviewed config file","Assert no cache-configuration warnings appear in a canary build after config edits"],"tags":["maven","cache-configuration","reference-type","config-parsing"],"backgroundTag":"invalid-configuration-value","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}