{"record":{"id":"0861ac1efc026d22","repo":"flowable/flowable-engine","slug":"id-is-null-0861ac","errorCode":null,"errorMessage":"id is null","messagePattern":"id is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":400,"severity":"error","filePath":"modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/cmd/DeletePrivilegeCmd.java","lineNumber":34,"sourceCode":"import java.io.Serializable;\n\nimport org.flowable.common.engine.api.FlowableIllegalArgumentException;\nimport org.flowable.common.engine.impl.interceptor.Command;\nimport org.flowable.common.engine.impl.interceptor.CommandContext;\nimport org.flowable.idm.engine.impl.util.CommandContextUtil;\n\n/**\n * @author Joram Barrez\n */\npublic class DeletePrivilegeCmd implements Command<Void>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n\n    protected String id;\n\n    public DeletePrivilegeCmd(String id) {\n        if (id == null) {\n            throw new FlowableIllegalArgumentException(\"id is null\");\n        }\n\n        this.id = id;\n    }\n\n    @Override\n    public Void execute(CommandContext commandContext) {\n        CommandContextUtil.getPrivilegeMappingEntityManager(commandContext).deleteByPrivilegeId(id);\n        CommandContextUtil.getPrivilegeEntityManager(commandContext).delete(id);\n        return null;\n    }\n}\n","sourceCodeStart":16,"sourceCodeEnd":47,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/cmd/DeletePrivilegeCmd.java#L16-L47","documentation":"DeletePrivilegeCmd's constructor rejects a null id because a privilege cannot be deleted without its identifier. The check runs at construction time, throwing FlowableIllegalArgumentException before the command reaches the entity manager.","triggerScenarios":"Calling new DeletePrivilegeCmd(null), or IdentityService.deletePrivilege(null) (via the privilege-mapping admin APIs) with a null privilege id.","commonSituations":"Privilege id obtained from a request path/body that was omitted; admin tooling iterating privileges where an entry has no id; constants/feature flags not yet defined so the id variable is null.","solutions":["Supply a valid non-null privilege id to IdentityService.deletePrivilege().","Confirm the privilege exists (createPrivilegeQuery().privilegeId(id).singleResult()) before deleting.","Validate request input in the admin endpoint layer before invoking the engine.","Catch FlowableIllegalArgumentException and return a 'privilege id required' error."],"exampleFix":"// before\nidentityService.deletePrivilege(privilegeId); // privilegeId may be null\n\n// after\nif (privilegeId == null) {\n    throw new IllegalArgumentException(\"privilegeId is required\");\n}\nidentityService.deletePrivilege(privilegeId);","handlingStrategy":"validation","validationCode":"if (privilegeId == null || privilegeId.isEmpty()) {\n    throw new IllegalArgumentException(\"privilegeId must be provided before deleting a privilege\");\n}","typeGuard":"boolean hasValidPrivilegeId(String privilegeId) {\n    return privilegeId != null && !privilegeId.isEmpty();\n}","tryCatchPattern":"try {\n    identityService.deletePrivilege(privilegeId);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().contains(\"id is null\")) {\n        throw new InvalidRequestException(\"Privilege id must not be null\");\n    }\n    throw e;\n}","preventionTips":["Verify the privilege exists via createPrivilegeQuery before deletion.","Validate admin API inputs with Bean Validation annotations.","Avoid driving privilege ids from unset configuration properties; fail at startup if missing.","Cover privilege admin endpoints with tests for missing ids."],"tags":["flowable","idm","null-check","privilege"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}