{"record":{"id":"05511d679bdd0ca0","repo":"flowable/flowable-engine","slug":"jobid-is-null-05511d","errorCode":null,"errorMessage":"jobId is null","messagePattern":"jobId is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/GetJobExceptionStacktraceCmd.java","lineNumber":48,"sourceCode":"public class GetJobExceptionStacktraceCmd implements Command<String>, Serializable {\n\n    private static final long serialVersionUID = 1L;\n    \n    protected JobServiceConfiguration jobServiceConfiguration;\n    \n    protected String jobId;\n    protected JobType jobType;\n\n    public GetJobExceptionStacktraceCmd(String jobId, JobType jobType, JobServiceConfiguration jobServiceConfiguration) {\n        this.jobId = jobId;\n        this.jobType = jobType;\n        this.jobServiceConfiguration = jobServiceConfiguration;\n    }\n\n    @Override\n    public String execute(CommandContext commandContext) {\n        if (jobId == null) {\n            throw new FlowableIllegalArgumentException(\"jobId is null\");\n        }\n\n        AbstractRuntimeJobEntity job = null;\n        switch (jobType) {\n        case ASYNC:\n            job = jobServiceConfiguration.getJobEntityManager().findById(jobId);\n            break;\n        case TIMER:\n            job = jobServiceConfiguration.getTimerJobEntityManager().findById(jobId);\n            break;\n        case SUSPENDED:\n            job = jobServiceConfiguration.getSuspendedJobEntityManager().findById(jobId);\n            break;\n        case DEADLETTER:\n            job = jobServiceConfiguration.getDeadLetterJobEntityManager().findById(jobId);\n            break;\n        case EXTERNAL_WORKER:\n            job = jobServiceConfiguration.getExternalWorkerJobEntityManager().findById(jobId);","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/GetJobExceptionStacktraceCmd.java#L30-L66","documentation":"GetJobExceptionStacktraceCmd.execute() validates its jobId before looking up the job entity. When the jobId passed to the command is null, it refuses to proceed and throws FlowableIllegalArgumentException. This fail-fast check prevents a pointless and ambiguous database lookup with a null identifier.","triggerScenarios":"Calling managementAPI/createJobQuery-based stack-trace retrieval APIs (e.g. ManagementService.getJobExceptionStacktrace, or executing GetJobExceptionStacktraceCmd directly) with jobId == null.","commonSituations":"Job id obtained from a nullable variable, a map lookup that missed, or an API wrapper that forwards null when the caller thinks the job exists; also happens when job id fields are not populated after deserialization.","solutions":["Check the jobId for null before calling the stack-trace API and return a clear error to your caller.","Trace where the job id comes from (query result, event payload, process variable) and fix the upstream producer of the null value.","If the job may genuinely not exist, first query for the job and handle the not-found case explicitly."],"exampleFix":"// before\nString stacktrace = managementService.getJobExceptionStacktrace(jobId);\n// after\nif (jobId != null) {\n    String stacktrace = managementService.getJobExceptionStacktrace(jobId);\n} else {\n    throw new IllegalStateException(\"Cannot fetch stacktrace: jobId was not set\");\n}","handlingStrategy":"validation","validationCode":"if (jobId == null) throw new IllegalArgumentException(\"jobId must be provided\");","typeGuard":"boolean hasJobId = (jobId != null && !jobId.isEmpty());","tryCatchPattern":"try { String st = managementService.getJobExceptionStacktrace(jobId); } catch (FlowableIllegalArgumentException e) { log.error(\"Bad argument: {}\", e.getMessage()); }","preventionTips":["Null-check all ids before calling job management APIs","Use Objects.requireNonNull at API boundaries in wrappers","Avoid caching job ids from sources that may be null"],"tags":["flowable","null-argument","job-service","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-18T11:17:12.947Z"}