{"record":{"id":"77dca70c659b90c2","repo":"flowable/flowable-engine","slug":"provided-id-is-null-77dca7","errorCode":null,"errorMessage":"Provided id is null","messagePattern":"Provided id 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":65,"sourceCode":"    protected String userIdLike;\n    protected String tokenData;\n    protected String tokenDataLike;\n\n    public TokenQueryImpl() {\n    }\n\n    public TokenQueryImpl(CommandContext commandContext) {\n        super(commandContext);\n    }\n\n    public TokenQueryImpl(CommandExecutor commandExecutor) {\n        super(commandExecutor);\n    }\n\n    @Override\n    public TokenQuery tokenId(String id) {\n        if (id == null) {\n            throw new FlowableIllegalArgumentException(\"Provided id is null\");\n        }\n        this.id = id;\n        return this;\n    }\n\n    @Override\n    public TokenQuery tokenIds(List<String> ids) {\n        if (ids == null) {\n            throw new FlowableIllegalArgumentException(\"Provided ids is null\");\n        }\n        this.ids = ids;\n        return this;\n    }\n\n    @Override\n    public TokenQuery tokenValue(String tokenValue) {\n        if (tokenValue == null) {\n            throw new FlowableIllegalArgumentException(\"Provided token value is null\");","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/TokenQueryImpl.java#L47-L83","documentation":"Flowable's TokenQueryImpl.tokenId(String id) throws FlowableIllegalArgumentException when the id argument is null. Token queries validate all criteria eagerly so bad queries fail with a clear message instead of an SQL error. A null id is not a meaningful query criterion.","triggerScenarios":"Calling tokenId(null) on a TokenQuery from createTokenQuery(), commonly when the token id came from a nullable variable, an entity that failed to load, or an unvalidated request parameter.","commonSituations":"Looking up a token by id after a lookup that returned null; passing an unset field of a DTO straight into the query builder; test code constructing queries programmatically with uninitialized values.","solutions":["Guard with a null check and only call tokenId when an id is present","Skip the criterion if you intend a broad query, or use tokenIds(List) with a validated non-null list","Log/return a domain-level 'token id missing' error from your service instead of building a query"],"exampleFix":"// before\nToken token = identityService.createTokenQuery().tokenId(tokenId).singleResult();\n// after\nif (tokenId == null) {\n    throw new IllegalArgumentException(\"token id required\");\n}\nToken token = identityService.createTokenQuery().tokenId(tokenId).singleResult();","handlingStrategy":"validation","validationCode":"if (tokenId == null) { throw new IllegalArgumentException(\"tokenId must not be null before tokenId()\"); }","typeGuard":"boolean hasTokenId(String tokenId) { return tokenId != null && !tokenId.isEmpty(); }","tryCatchPattern":"try { query.tokenId(id); } catch (FlowableIllegalArgumentException e) { log.warn(\"Invalid token query: {}\", e.getMessage()); }","preventionTips":["Resolve entity lookups before using their ids in queries","Validate request parameters before passing them into Flowable queries","Fail fast in your own service layer with domain-specific messages"],"tags":["flowable","idm","query","token","null-check"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}