{"record":{"id":"fb4533999c9cc179","repo":"jwtk/jjwt","slug":"name-is-missing-required-param-value","errorCode":null,"errorMessage":"${name()} is missing required ${param} value.","messagePattern":"(.+?) is missing required (.+?) value\\.","errorType":"validation","errorClass":"MalformedJwtException","httpStatus":null,"severity":"error","filePath":"impl/src/main/java/io/jsonwebtoken/impl/lang/RequiredParameterReader.java","lineNumber":56,"sourceCode":"\n    private String name() {\n        return ((Nameable) this.src).getName();\n    }\n\n    private JwtException malformed(String msg) {\n        if (this.src instanceof JwkContext || this.src instanceof Jwk) {\n            return new MalformedKeyException(msg);\n        } else {\n            return new MalformedJwtException(msg);\n        }\n    }\n\n    @Override\n    public <T> T get(Parameter<T> param) {\n        T value = this.src.get(param);\n        if (value == null) {\n            String msg = name() + \" is missing required \" + param + \" value.\";\n            throw malformed(msg);\n        }\n        return value;\n    }\n}\n","sourceCodeStart":38,"sourceCodeEnd":61,"githubUrl":"https://github.com/jwtk/jjwt/blob/fb71496164c71442d08adec4571d9616ed5e1b8d/impl/src/main/java/io/jsonwebtoken/impl/lang/RequiredParameterReader.java#L38-L61","documentation":"A MalformedJwtException (via malformed()) raised when a required Parameter named by the JWT/JWK document is absent (null) from the parsed source. RequiredParameterReader.get enforces that every parameter marked required in a spec (e.g. an RSA JWK's 'n' and 'e', or a JWE header's required claims) is present; missing ones make the object invalid. The message names the owner (name()) and the missing parameter.","triggerScenarios":"Parsing or processing a JWK/JWT whose header, payload, or key parameters omit a field the spec requires, e.g. an EC JWK without 'crv', a protected header without the required algorithm/claim, when calling get(param) on the reader during processing.","commonSituations":"Hand-built or third-party tokens/JWKs missing mandatory fields; stripping claims in a gateway; storing JWKs in a database with nullable columns and re-serializing partial objects.","solutions":["Add the missing required parameter to the token/JWK before use (e.g. include 'n' and 'e' in an RSA JWK).","Check whether an upstream proxy or serializer is dropping null/empty fields and disable that behavior.","Catch MalformedJwtException and reject the token with a clear 401/400 response.","Regenerate the key/token with jjwt's builder so all required fields are emitted."],"exampleFix":"// before: JWK map missing 'e'\n{ \"kty\":\"RSA\", \"n\":\"...\" }\n// after\n{ \"kty\":\"RSA\", \"n\":\"...\", \"e\":\"AQAB\" }","handlingStrategy":"validation","validationCode":"// for JWKs: check required fields before use\nif (!jwkMap.containsKey(\"n\") || !jwkMap.containsKey(\"e\"))\n    throw new InvalidJwkException(\"RSA JWK missing n/e\");","typeGuard":"boolean hasRequired = jwkMap != null && jwkMap.containsKey(\"kty\") && jwkMap.get(\"kty\") != null;","tryCatchPattern":"try {\n    return Jwts.parser().verifyWith(key).build().parseSignedClaims(token);\n} catch (MalformedJwtException e) {\n    throw new UnauthorizedException(\"JWT missing required claims\", e);\n}","preventionTips":["Never strip required claims/parameters in proxies or gateways","Use jjwt builders to emit tokens so required fields are never omitted","Use non-nullable columns for JWK material in storage","Validate third-party JWK Sets on import"],"tags":["jwt","jwk","missing-parameter","validation"],"backgroundTag":"missing-required-argument","analyzedSha":"fb71496164c71442d08adec4571d9616ed5e1b8d","analyzedAt":"2026-09-09T00:33:09.982Z","contentChangedAt":"2026-09-09T00:33:09.982Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}