{"record":{"id":"975b4ce8c53dadb2","repo":"flowable/flowable-engine","slug":"id-is-null-975b4c","errorCode":null,"errorMessage":"id is null","messagePattern":"id is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-batch-service/src/main/java/org/flowable/batch/service/impl/BatchPartQueryImpl.java","lineNumber":67,"sourceCode":"    public BatchPartQueryImpl(CommandExecutor commandExecutor, BatchServiceConfiguration batchServiceConfiguration) {\n        super(commandExecutor);\n        this.batchServiceConfiguration = batchServiceConfiguration;\n    }\n\n    @Override\n    public long executeCount(CommandContext commandContext) {\n        return batchServiceConfiguration.getBatchPartEntityManager().findBatchPartCountByQueryCriteria(this);\n    }\n\n    @Override\n    public List<BatchPart> executeList(CommandContext commandContext) {\n        return batchServiceConfiguration.getBatchPartEntityManager().findBatchPartsByQueryCriteria(this);\n    }\n\n    @Override\n    public BatchPartQuery id(String id) {\n        if (id == null) {\n            throw new FlowableIllegalArgumentException(\"id is null\");\n        }\n        this.id = id;\n        return this;\n    }\n\n    @Override\n    public BatchPartQuery batchId(String batchId) {\n        if (batchId == null) {\n            throw new FlowableIllegalArgumentException(\"batchId is null\");\n        }\n        this.batchId = batchId;\n        return this;\n    }\n\n    @Override\n    public BatchPartQuery type(String type) {\n        if (type == null) {\n            throw new FlowableIllegalArgumentException(\"type is null\");","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-batch-service/src/main/java/org/flowable/batch/service/impl/BatchPartQueryImpl.java#L49-L85","documentation":"BatchPartQueryImpl.id(String) sets the primary-key filter on a batch part query. Passing null is treated as a programming error, so Flowable throws FlowableIllegalArgumentException instead of returning all results or filtering on 'null id'. The exception is thrown immediately from the id(...) call, before query execution.","triggerScenarios":"Calling batchService.createBatchPartQuery().id(null), typically when the id comes from an unvalidated variable, optional lookup, or a request parameter.","commonSituations":"REST handlers forwarding request params straight into queries; Optional.map chains returning null when the optional was empty; records whose id was never generated.","solutions":["Null-check the id before calling id(...), or skip the filter entirely when absent.","Use a singleResult()/list() call appropriate to whether an id filter is applied.","If id comes from Optional<String>, use optional.orElseThrow(...) or branch on isPresent()."],"exampleFix":"// before\nBatchPart part = batchService.createBatchPartQuery().id(inputId).singleResult();\n// after\nif (inputId == null) {\n    throw new IllegalArgumentException(\"batch part id required\");\n}\nBatchPart part = batchService.createBatchPartQuery().id(inputId).singleResult();","handlingStrategy":"validation","validationCode":"java.util.Objects.requireNonNull(partId, \"partId must not be null\");\nBatchPart part = batchService.createBatchPartQuery().id(partId).singleResult();","typeGuard":"boolean hasId(String id) {\n    return id != null && !id.isEmpty();\n}","tryCatchPattern":"try {\n    BatchPart part = batchService.createBatchPartQuery().id(partId).singleResult();\n} catch (org.flowable.common.engine.api.FlowableIllegalArgumentException e) {\n    throw new IllegalArgumentException(\"Invalid batch part id passed to query: \" + partId, e);\n}","preventionTips":["Validate ids at API boundaries before they reach query code.","Prefer Optional<String> with explicit orElseThrow for ids that may be absent."],"tags":["flowable","batch","query","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"}