ExpirePolicySchedule batch error

Last updated: October 6, 2026

Overview

If you receive an email with the subject "ExpirePolicySchedule Batch Error" containing an UNABLE_TO_LOCK_ROW error, this article explains what it means, why it happens, and what to do about it.

This common notification can appear when two nightly scheduled jobs run close together and briefly try to update the same policy records at the same time.

What causes the error?

The error UNABLE_TO_LOCK_ROW indicates that the current process or automation was unable to get exclusive write access to a record because another process had it open at the same time.

In Amplo, two scheduled Apex jobs run nightly to update policy statuses: Expire Policy and Update Policy Pending Status. Both jobs evaluate records based on the policy's expiration date, and infrequently, both jobs may try to update the same record within a short time window. This overlap causes a temporary lock conflict, triggering the error and notification email. For more information on these specific jobs, see Policy Status Updates Scheduled Jobs.

Do the policies still update correctly?

Even when this error notification is sent, the affected policies are typically still updated to Expired status. To confirm, you can review the policy's Policy History to see whether the status updated when the job ran. You can also check the Apex Jobs log in Salesforce Setup for failures.

Rescheduling the jobs

While the error should occur infrequently and cause no data issues, you can reschedule the jobs with a larger gap between them to further prevent issues.

  1. Go to Setup → Apex Classes → Scheduled Jobs (Apex Jobs).

  2. Pause or delete the existing scheduled jobs for both Expire Policy and Update Policy Pending Status.

  3. Recreate them using the same Apex classes, with following Cron expressions:

    • Update Policy Pending Status: 0 0 2 * * ? * (daily at 2:00 a.m.)

    • Expire Policy: 0 0 4 * * ? * (daily at 4:00 a.m.)

  4. Confirm both jobs are active and on the new schedule.