flowable/flowable-engine · error · FlowableIllegalArgumentException

id is null

Error message

id is null

What it means

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.

Source

Thrown at modules/flowable-idm-engine/src/main/java/org/flowable/idm/engine/impl/cmd/DeletePrivilegeCmd.java:34

import java.io.Serializable;

import org.flowable.common.engine.api.FlowableIllegalArgumentException;
import org.flowable.common.engine.impl.interceptor.Command;
import org.flowable.common.engine.impl.interceptor.CommandContext;
import org.flowable.idm.engine.impl.util.CommandContextUtil;

/**
 * @author Joram Barrez
 */
public class DeletePrivilegeCmd implements Command<Void>, Serializable {

    private static final long serialVersionUID = 1L;

    protected String id;

    public DeletePrivilegeCmd(String id) {
        if (id == null) {
            throw new FlowableIllegalArgumentException("id is null");
        }

        this.id = id;
    }

    @Override
    public Void execute(CommandContext commandContext) {
        CommandContextUtil.getPrivilegeMappingEntityManager(commandContext).deleteByPrivilegeId(id);
        CommandContextUtil.getPrivilegeEntityManager(commandContext).delete(id);
        return null;
    }
}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Supply a valid non-null privilege id to IdentityService.deletePrivilege().
  2. Confirm the privilege exists (createPrivilegeQuery().privilegeId(id).singleResult()) before deleting.
  3. Validate request input in the admin endpoint layer before invoking the engine.
  4. Catch FlowableIllegalArgumentException and return a 'privilege id required' error.

Example fix

// before
identityService.deletePrivilege(privilegeId); // privilegeId may be null

// after
if (privilegeId == null) {
    throw new IllegalArgumentException("privilegeId is required");
}
identityService.deletePrivilege(privilegeId);
Defensive patterns

Strategy: validation

Validate before calling

if (privilegeId == null || privilegeId.isEmpty()) {
    throw new IllegalArgumentException("privilegeId must be provided before deleting a privilege");
}

Type guard

boolean hasValidPrivilegeId(String privilegeId) {
    return privilegeId != null && !privilegeId.isEmpty();
}

Try / catch

try {
    identityService.deletePrivilege(privilegeId);
} catch (FlowableIllegalArgumentException e) {
    if (e.getMessage().contains("id is null")) {
        throw new InvalidRequestException("Privilege id must not be null");
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling new DeletePrivilegeCmd(null), or IdentityService.deletePrivilege(null) (via the privilege-mapping admin APIs) with a null privilege id.

Common situations: 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.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/0861ac1efc026d22. Report an issue: GitHub.