flowable/flowable-engine · error · FlowableIllegalArgumentException

historyJobId is null

Error message

historyJobId is null

What it means

GetHistoryJobAdvancedConfigurationCmd throws FlowableIllegalArgumentException when historyJobId is null, then loads the history job and throws JobNotFoundException when missing. It returns the advanced configuration (handler-specific JSON) for a history job, which requires a valid id.

Source

Thrown at modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/cmd/GetHistoryJobAdvancedConfigurationCmd.java:45

 * 
 * @author Joram Barrez
 */
public class GetHistoryJobAdvancedConfigurationCmd implements Command<String> {

    private static final Logger LOGGER = LoggerFactory.getLogger(GetHistoryJobAdvancedConfigurationCmd.class);

    protected JobServiceConfiguration jobServiceConfiguration;
    protected String historyJobId;

    public GetHistoryJobAdvancedConfigurationCmd(String historyJobId, JobServiceConfiguration jobServiceConfiguration) {
        this.historyJobId = historyJobId;
        this.jobServiceConfiguration = jobServiceConfiguration;
    }

    @Override
    public String execute(CommandContext commandContext) {
        if (historyJobId == null) {
            throw new FlowableIllegalArgumentException("historyJobId is null");
        }

        HistoryJobEntity historyJobEntity = jobServiceConfiguration.getHistoryJobEntityManager().findById(historyJobId);
        if (historyJobEntity == null) {
            throw new JobNotFoundException(historyJobId);
        }
        return historyJobEntity.getAdvancedJobHandlerConfiguration();
    }

}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Obtain the id from a HistoryJobQuery result and check it is non-null before calling.
  2. Catch FlowableObjectNotFoundException/JobNotFoundException when the job may have been cleaned up.
  3. Verify the history job still exists in ACT_RU_HISTORY_JOB (cleanup jobs may have removed it).
  4. In tooling, render a friendly 'not found' message instead of letting the exception propagate.

Example fix

// before
String cfg = managementService.getHistoryJobAdvancedConfiguration(historyJobId);
// after
HistoryJob job = managementService.createHistoryJobQuery().jobId(historyJobId).singleResult();
if (job != null) {
    String cfg = managementService.getHistoryJobAdvancedConfiguration(historyJobId);
}
Defensive patterns

Strategy: validation

Validate before calling

HistoryJob job = managementService.createHistoryJobQuery().jobId(historyJobId).singleResult();
if (job == null) { return null; } // or friendly error

Try / catch

try { return managementService.getHistoryJobAdvancedConfiguration(id); } catch (FlowableObjectNotFoundException e) { return null; }

Prevention

When it happens

Trigger: managementService.getHistoryJobAdvancedConfiguration(null) or executing the command with a null id; querying a deleted history job id.

Common situations: Admin tooling inspecting async history jobs where the id was taken from an empty/optional result; ids reused after history job cleanup removed the row.

Related errors


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