{"record":{"id":"4195dc5b3f78db34","repo":"flowable/flowable-engine","slug":"provided-exception-message-is-null-4195dc","errorCode":null,"errorMessage":"Provided exception message is null","messagePattern":"Provided exception message is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/SuspendedJobQueryImpl.java","lineNumber":573,"sourceCode":"            noRetriesLeft = true;\n        }\n        return this;\n    }\n\n    @Override\n    public SuspendedJobQueryImpl withException() {\n        if (inOrStatement) {\n            this.currentOrQueryObject.withException = true;\n        } else {\n            this.withException = true;\n        }\n        return this;\n    }\n\n    @Override\n    public SuspendedJobQueryImpl exceptionMessage(String exceptionMessage) {\n        if (exceptionMessage == null) {\n            throw new FlowableIllegalArgumentException(\"Provided exception message is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.exceptionMessage = exceptionMessage;\n        } else {\n            this.exceptionMessage = exceptionMessage;\n        }\n        return this;\n    }\n\n    @Override\n    public SuspendedJobQueryImpl jobTenantId(String tenantId) {\n        if (tenantId == null) {\n            throw new FlowableIllegalArgumentException(\"Provided tenant id is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.tenantId = tenantId;\n        } else {\n            this.tenantId = tenantId;","sourceCodeStart":555,"sourceCodeEnd":591,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/SuspendedJobQueryImpl.java#L555-L591","documentation":"exceptionMessage(String) narrows the suspended-job query to jobs whose failure carries the given exception message. Null is rejected with FlowableIllegalArgumentException because matching against a null message is undefined; the query builder fails fast.","triggerScenarios":"Calling query.exceptionMessage(msg) with msg == null, e.g. taking the message from a caught exception where getMessage() returned null, or from an absent configuration value.","commonSituations":"Dead-letter monitoring dashboards filtering by failure reason; NullPointerException-derived messages (getMessage() returns null for NPEs constructed without a message) passed straight into the query.","solutions":["Pass a non-null string; use an empty string only if that is truly the stored value.","If filtering by exception is optional, skip the call when the message is null.","Fall back to a meaningful default (e.g. exception class name) when getMessage() is null.","Use exceptionStackTrace() or jobExceptionMessageLike-style matching if exact message is unavailable."],"exampleFix":"// before\nquery.exceptionMessage(e.getMessage()); // may be null\n// after\nString msg = e.getMessage() != null ? e.getMessage() : e.getClass().getName();\nquery.exceptionMessage(msg);","handlingStrategy":"validation","validationCode":"if (exceptionMessage == null) {\n    throw new IllegalArgumentException(\"exceptionMessage requires a non-null string\");\n}","typeGuard":"boolean hasMessage(Throwable t) { return t != null && t.getMessage() != null; }","tryCatchPattern":"try {\n    query.exceptionMessage(msg);\n} catch (FlowableIllegalArgumentException e) {\n    // fall back to a non-null representation\n    query.exceptionMessage(\"unknown\");\n}","preventionTips":["Replace null Throwable.getMessage() with the exception class name before filtering.","Skip the exceptionMessage filter when the message is optional and null.","Be especially careful with NullPointerExceptions, whose messages are often null."],"tags":["flowable","job-query","null-argument","illegal-argument"],"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"}