← All guides

Job Queue Errors That Repeat Every Night: Breaking the Loop

Troubleshooting · 6 min read · By Dex Carter · Published 2026-10-26 · Last updated 2026-10-26

Clipboard with a flagged entry circled by repeating arrows, server racks, and a log page under a magnifying glass
The same flagged entry, night after night, read the log before restarting it again.

Restarting a failed job queue entry feels like fixing it. The entry goes back to work, the error disappears from view, and everyone moves on, until the same error returns the next night, at roughly the same time, for roughly the same reason. That pattern is the clue. A job that errors every night is not unlucky. It is faithfully re-running the same failing condition, and the restart changed nothing about that condition.

The myth: 'just restart it', and why the loop disagrees

Start with what a restart actually does. Job queue entries stop running when there is an error (s1). Restarting the entry runs the same job, with the same data and the same code, against the same condition that stopped it. Sometimes that is enough: a temporary failure, such as an external service being briefly unavailable, may have cleared by the next attempt.

But Microsoft's own guidance draws the line clearly: if a restart does not help, the issue might be in the code (s1). In other words, a restart is a test, not a treatment. One restart that succeeds tells you the failure may have been transient. A restart that fails the same way, night after night, tells you the condition is still there, and the job is doing exactly what it was asked to do, against data or code that cannot succeed.

For retail, the cost of the loop is easy to miss. The failing job is often a night-time process, the kind of run nobody watches live. Each morning starts with the same workaround instead of a finished job, and the workaround quietly becomes the process.

Read the loop: log entries, stack trace, and the first night it failed

Before changing any setting, read the failure properly. Use this procedure:

  1. Open the Job Queue Log for the entry. Find the repeated error, not just the most recent one. Note whether the error text is identical each night or changes.
  2. Read the AL stack trace. Microsoft points to the stack trace in the Job Queue Log as the way to identify the owner or publisher of the code involved (s1). That tells you whether the failing code is standard, an extension, or something custom, and therefore who can fix it.
  3. Find the first night it failed. A job that ran for months and then started failing points to something that changed around that first failure: data, setup, or code. A job that has never run clean is a different problem.
  4. Record the support details. If the issue goes to support, Microsoft asks for the job queue entry run ID, the error timestamp, and your timezone; newer versions offer a Copy details action for this (s1).

What success looks like: you can state, in one sentence, what condition the job hits when it fails, not just that it fails. Without that sentence, every later step is guessing.

Separate the classes: transient, data, code, and not-running-at-all

Recurring errors fall into distinct classes, and each class has a different fix:

The decision framework is simple: match the fix to the class. Retries for transient failures. Correction for data and setup. The code owner for code. Dispatcher and session checks for an entry that never starts. Applying the transient fix to the other three classes is what creates the nightly loop.

Tune the safety net: attempts, rerun delay, and category separation

Once the condition is understood, the built-in safety net has two settings. Maximum No. of Attempts and Rerun Delay (sec.) can keep an entry running until an external service becomes available again (s1). Used deliberately, they ride out a brief outage without a human restarting anything at midnight.

Used blindly, they do something else: they repeat the same deterministic failure several times a night instead of once. Attempts and delay do not change the outcome for a data, setup, or code error, they only change how often it fails before stopping. Tune them after the class is known, not before.

Category separation matters in the not-running case: the checks for a stuck entry include its job queue category assignment (s3). Keeping unrelated jobs from sharing one entry's fate makes the next failure easier to read, one entry, one job, one error to explain.

Fix the drift: starting times that stay put night after night

Some 'wrong time every night' complaints are not errors at all. They are schedule drift. A Dynamics Community answer documents a job set to run every 720 minutes drifting because the recurrence is calculated from the end time of the previous run, not from a fixed time of day (s4). If a run finishes later than usual, the next run starts later too, and the drift compounds.

The workaround given in that answer is to create two job queues. AM and PM, with fixed Starting Times, instead of relying on one 12-hour recurrence (s4). The principle transfers to nightly retail jobs: if a job must start at a set time, anchor it to a fixed starting time rather than to an interval counted from whenever the previous run happened to end. A job that starts late can also collide with the next process in the night sequence, which then looks like a second, unrelated failure.

Decide on auto-restart: when a restarter helps and when it hides a fire

The tempting shortcut is a restarter: a small codeunit that watches for failed entries and restarts them automatically. A published example filters Job Queue Entry records on Status = Error, with a Parameter String object filter, and calls the built-in Restart() method on each match (s2). The same post notes a useful design point: keeping the restarter isolated in its own app avoids the monitoring job itself becoming a failure point (s2).

Decide with this test:

Breaking the loop, in order: read the log and the stack trace, name the failing condition, fix that condition, then, and only then, tune attempts, rerun delay, and starting times so a genuinely temporary failure no longer needs a human at midnight.

, Dex Carter, Tech Writer

IndexBack to all guides →