Loading

Salesforce Apex Batch Jobs Stuck in 'Holding' or 'Queued' Status — How to Resolve

Дата публикации: Jun 13, 2026
Описание

Overview

Salesforce Apex batch jobs may become stuck in a "Holding" or "Queued" status and stop executing. When this happens, all submitted batch jobs stop running and none progress to completion. This typically occurs when there is a stalled system token job in the Apex job queue with a JobType of "ApexToken" that is blocking the queue.
This article explains how to diagnose whether the issue is a platform-level problem requiring Salesforce Support intervention, and how to resolve it if it is not.

Решение

Step 1: Diagnose — Check for ApexToken Jobs

First, determine whether the batch job queue is blocked by a stalled system ApexToken job. Run the following query using the Developer Console or Workbench:
Query the AsyncApexJob object where JobType equals 'ApexToken' and Status equals 'Queued'. In SOQL: SELECT Id, CreatedDate FROM AsyncApexJob WHERE JobType='ApexToken' AND Status='Queued'
If records are returned: This indicates a platform-level issue. Log a case with Salesforce Support and provide the query results. Do not proceed to Step 2.
If no records are returned: The queue blockage is not caused by an ApexToken job. Proceed to Step 2.

Step 2: Abort Stuck Jobs Using Workbench (No ApexToken Records Found)

If the ApexToken query returns no records, follow these steps to manually abort all stuck jobs:

  1. Log in to Workbench.
  2. In the top-right corner, click your name and API version link to open API version settings.
  3. Change the API version to 31. This step is required — using a newer API version will cause an error when aborting jobs (see Note below).
  4. Navigate to Utilities, then Apex Execute.
  5. Run a script that queries all AsyncApexJob records where Status is 'Queued' or 'Holding', and calls System.AbortJob() on each record's Id.
  6. All existing stuck jobs will be deleted.
  7. Reschedule your batch jobs as needed.

Important Note on API Version

You must use API version 31 for the abort script. If you run the abort script using a newer API version, you will receive the following error:
System.StringException: You can't abort scheduled apex jobs by calling System.abortjob() with an AsyncApexJob ID. You must call System.abortjob with the parent CronTrigger ID.
This error does not occur when using API version 31. Always change the API version to 31 before executing the abort script in Workbench.   

 

Номер статьи базы знаний

000381767

 
Загрузка
Salesforce Help | Article