{"record":{"id":"883bee8f4defcd2f","repo":"jwtk/jjwt","slug":"unrecognized-qualifiedkeyname-key","errorCode":null,"errorMessage":"Unrecognized ${qualifiedKeyName}: ${key}","messagePattern":"Unrecognized (.+?): (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"impl/src/main/java/io/jsonwebtoken/impl/lang/DefaultRegistry.java","lineNumber":60,"sourceCode":"\n    public DefaultRegistry(String name, String keyName, Collection<? extends V> values, Function<V, K> keyFn) {\n        super(toMap(values, keyFn));\n        name = Assert.hasText(Strings.clean(name), \"name cannot be null or empty.\");\n        keyName = Assert.hasText(Strings.clean(keyName), \"keyName cannot be null or empty.\");\n        this.qualifiedKeyName = name + \" \" + keyName;\n    }\n\n    @Override\n    public V apply(K k) {\n        return get(k);\n    }\n\n    @Override\n    public V forKey(K key) {\n        V value = get(key);\n        if (value == null) {\n            String msg = \"Unrecognized \" + this.qualifiedKeyName + \": \" + key;\n            throw new IllegalArgumentException(msg);\n        }\n        return value;\n    }\n\n    static <T> T immutable() {\n        throw new UnsupportedOperationException(\"Registries are immutable and cannot be modified.\");\n    }\n\n    @Override\n    public V put(K key, V value) {\n        return immutable();\n    }\n\n    @Override\n    public V remove(Object key) {\n        return immutable();\n    }\n","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/jwtk/jjwt/blob/fb71496164c71442d08adec4571d9616ed5e1b8d/impl/src/main/java/io/jsonwebtoken/impl/lang/DefaultRegistry.java#L42-L78","documentation":"DefaultRegistry.forKey looks up a registry entry by key and throws IllegalArgumentException ('Unrecognized <qualifiedKeyName>: <key>') when the key is absent. Registries in JJWT hold known instances keyed by identifiers, such as JWA algorithms or compression codecs.","triggerScenarios":"Passing an algorithm/codec id string not present in the registry, e.g. looking up 'HS512' in a registry that excludes it, a typo like 'HS356', or an algorithm disabled at runtime (weak-key checks removed it).","commonSituations":"Configuring a JWT parser/signer with an algorithm name from properties that contains whitespace or wrong case; referencing an algorithm the installed key doesn't support; version changes where a registry no longer contains an id.","solutions":["Verify the exact key string (case, spelling, no whitespace) against the registry's documented ids.","Check registry contents/containsKey (get returns null) before calling forKey.","Ensure the corresponding provider/module is on the classpath if the id should exist (e.g. optional crypto providers)."],"exampleFix":"// before\nSignatureAlgorithm alg = registry.forKey(config.getAlg()); // typo 'HS356'\n// after\nString id = config.getAlg();\nif (registry.forKey == null || !SignatureAlgorithm.NAMES.contains(id)) {\n    throw new IllegalArgumentException(\"Unknown algorithm: \" + id);\n}","handlingStrategy":"validation","validationCode":"V val = registry.get(key); // or containsKey if available\nif (val == null) {\n    throw new IllegalArgumentException(\"Unsupported id: \" + key);\n}","typeGuard":null,"tryCatchPattern":"try {\n    V v = registry.forKey(id);\n} catch (IllegalArgumentException e) {\n    // fall back to default id or surface a clear config error\n}","preventionTips":["Validate algorithm/codec ids from config against documented names at startup","Trim and case-normalize externally supplied identifiers","Use library constants (e.g. SignatureAlgorithm.HS512) instead of raw strings"],"tags":["registry","lookup-failed","jwt"],"backgroundTag":"invalid-enum-value","analyzedSha":"fb71496164c71442d08adec4571d9616ed5e1b8d","analyzedAt":"2026-09-09T00:33:09.982Z","contentChangedAt":"2026-09-09T00:33:09.982Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}