{"record":{"id":"34cef6db10c4e5fb","repo":"flowable/flowable-engine","slug":"provided-token-data-is-null","errorCode":null,"errorMessage":"Provided token data is null","messagePattern":"Provided token data is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/TokenQueryImpl.java","lineNumber":173,"sourceCode":"            throw new FlowableIllegalArgumentException(\"Provided user id is null\");\n        }\n        this.userId = userId;\n        return this;\n    }\n\n    @Override\n    public TokenQuery userIdLike(String userIdLike) {\n        if (userIdLike == null) {\n            throw new FlowableIllegalArgumentException(\"Provided userIdLike is null\");\n        }\n        this.userIdLike = userIdLike;\n        return this;\n    }\n\n    @Override\n    public TokenQuery tokenData(String tokenData) {\n        if (tokenData == null) {\n            throw new FlowableIllegalArgumentException(\"Provided token data is null\");\n        }\n        this.tokenData = tokenData;\n        return this;\n    }\n\n    @Override\n    public TokenQuery tokenDataLike(String tokenDataLike) {\n        if (tokenDataLike == null) {\n            throw new FlowableIllegalArgumentException(\"Provided tokenDataLike is null\");\n        }\n        this.tokenDataLike = tokenDataLike;\n        return this;\n    }\n\n    // sorting //////////////////////////////////////////////////////////\n\n    @Override\n    public TokenQuery orderByTokenId() {","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/TokenQueryImpl.java#L155-L191","documentation":"TokenQueryImpl.tokenData(String) filters tokens by exact token data (e.g. the serialized/hashed token value). A null argument is rejected with FlowableIllegalArgumentException because null is not a valid equality criterion. Fail-fast validation keeps query semantics unambiguous.","triggerScenarios":"Calling TokenQuery.tokenData(null), e.g. identityService.createTokenQuery().tokenData(hashedValue) where the hashed value computation returned null.","commonSituations":"Token lookup flows where the incoming raw token was null/absent and hashing still ran; cache or lookup misses returned null; misconfigured token providers.","solutions":["Ensure the token data value is computed/available before the lookup; bail out earlier if the raw token was absent.","Conditionally apply tokenData only for non-null values.","If the token was not supplied at all, reject the request upstream rather than querying with null."],"exampleFix":"// before\nString data = hasher.hash(rawToken); // null if rawToken is null\nToken token = identityService.createTokenQuery().tokenData(data).singleResult();\n\n// after\nif (rawToken == null) {\n    throw new InvalidTokenException(\"Token value missing\");\n}\nString data = hasher.hash(rawToken);\nToken token = identityService.createTokenQuery().tokenData(data).singleResult();","handlingStrategy":"validation","validationCode":"if (tokenData == null) {\n    throw new InvalidTokenException(\"Token data must be computed before lookup\");\n}\nidentityService.createTokenQuery().tokenData(tokenData);","typeGuard":"boolean hasTokenData(String v) { return v != null && !v.isEmpty(); }","tryCatchPattern":"try {\n    query.tokenData(data);\n} catch (FlowableIllegalArgumentException e) {\n    throw new InvalidTokenException(\"Token lookup aborted: token data was null\", e);\n}","preventionTips":["Reject requests with a missing raw token before hashing/lookup.","Ensure hashing/encoding helpers never silently return null.","Log the upstream cause when token data ends up null."],"tags":["null-check","query-builder","idm-engine","java"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}