Skip to main content
Plexara
Governance9 min read

611 - When an automation fails at 2 a.m.

A failing automation is one incident, not one message per run: the first failed scheduled run emails its owner and posts to the operations channels an administrator named, the runs that keep failing send nothing, and the first run that succeeds sends one recovery message with when the failing began, how long it lasted, how many runs failed, and the error. Followed on the demo tenant through a real incident. Runs started by hand report in their answer and never alert, temporary upstream errors are retried within the run, every failure carries its cause and whether a retry should help, and the agent is briefed on failing automations at the start of the next session.

What you will take away from this lesson

An automation that runs every ten minutes and starts failing at two in the morning has failed thirty times by the time anyone is at a desk. Thirty alerts is how a channel gets muted, and a muted channel is how the next real problem goes unseen.

Plexara treats the failing as one incident. This lesson follows a real one on the demo tenant from the first failed run to the recovery, and covers what each failure records about itself so the person who reads it in the morning knows whether to act.

Learning Objectives

  1. 01Explain why a failing automation is one incident: one failure message, silence while it keeps failing, and one recovery message.
  2. 02Read a recovery message: when the failing began, how long it lasted, how many runs failed, and the error.
  3. 03Name the operations channels a failing automation posts to, under Admin > Settings > Run failures.
  4. 04Know which failures alert and which do not: a scheduled or event run alerts, a run started by hand reports in its answer.
  5. 05Read a failure’s cause and whether a retry should help, and know what is retried within a run.
  6. 06Know that the agent is told about failing automations at the start of the next session.

Where this lesson sits

Lesson 604 said a failed scheduled run emails its owner and is never re-run on its own, and 608 covered the channels results go out on. This lesson puts the two together for the hours nobody is watching.

600 Series: Automations

Open index

The 600 series picks up the registered table from the 500 series and the prompt mechanics from the 400 series.

One incident, two messages

Six rules turn a run of failures into something a person can act on in the morning.

One incident, two messages

  1. 01

    The first failed run opens the incident

    A scheduled or event run that fails emails the automation’s owner and posts to the run-failure channels. The message names the automation, why the run failed, the head of its error, the tail of its log, and a link to the run.

  2. 02

    Runs that keep failing send nothing

    They are counted on the incident. An automation that fails every five minutes overnight sends one message, not dozens.

  3. 03

    The first run that succeeds closes it

    Scheduled or started by hand, the next successful run sends one recovery message: the run that succeeded, when the failing began and how long it lasted, how many runs failed, the error, and the run that began it.

  4. 04

    Recovered means the latest run succeeded

    It does not mean what the failed runs left undone was redone. That happens only when the automation redoes it, as a watermark that was never moved does, and the message says so.

  5. 05

    A run started by hand reports in its answer

    Its failure is in the response the person or agent is already reading, so it sends nothing. A canceled run neither opens nor closes an incident; a run whose worker was lost counts as a failure.

  6. 06

    The incident survives a restart

    It is kept in the database, so a failure on one server pairs with the recovery on another, and an upgrade in the middle loses nothing.

Where the messages go

The owner is accountable for an automation and always gets the email. An operations team that watches a channel rather than each owner’s inbox is named once, for every automation.

Admin > Settings > Run failures

What the agent calls. This is the exchange the agent has with Plexara on your behalf, shown for the technical reader. You ask in plain language; you never type any of it.

PUT /api/v1/admin/settings/script-run-alert
  {"channels": ["ops-events", "store-ops"]}

-> 200  {"channels": ["ops-events", "store-ops"],
         "updated_by": "[email protected]"}

An administrator names up to ten notification channels once, for every automation on the deployment. On the demo tenant they are the ops-events webhook channel, which a system routes on, and the store-ops email list, which people read. The owner’s email goes out either way. Naming a channel here is the authorization: the platform posts as itself, so no persona is consulted. The failure post and the recovery post carry different keys, so a channel’s repeat window never holds back the recovery that ends an incident.

The automation that failed

The incident below comes from a small automation written for this lesson, which depends on a feed that can stop.

acme-pos-feed-rollup-611, its main()

def main():
    counts = window(run.fire_time)
    if counts["events"] == 0:
        fail("no point-of-sale events arrived in the ten minutes before %s; "
             "the pos-sales feed has not published" % run.fire_time, retryable = True)
    platform.result({"window_end": run.fire_time, "sales": ..., "returns": ...,
                     "revenue": ..., "stores": ...})

# window() counts the events, returns, revenue and stores the pos-sales
# table received in the ten minutes before the fire.

A ten-minute roll-up of the point-of-sale feed, scheduled every ten minutes. An empty window means the feed did not publish, so the run fails, and says the failure is temporary with retryable = True: the condition is outside the script and the next run may not meet it. To produce the incident below, the simulator that feeds pos-sales was paused for half an hour.

The incident, run by run

With the feed paused, the next two scheduled runs found an empty window and failed. When the feed resumed, the run after them succeeded.

The incident on the demo tenant

What the agent calls. This is the exchange the agent has with Plexara on your behalf, shown for the technical reader. You ask in plain language; you never type any of it.

manage_script runs  acme-pos-feed-rollup-611

   fired  trigger   status     cause      retryable
   09:20  schedule  succeeded
   09:30  schedule  failed     transient  true   -> incident opened, one post
   09:40  schedule  failed     transient  true   -> counted, nothing sent
   09:50  schedule  succeeded                    -> recovered, one post

posted to ops-events at 09:30
   The scheduled automation "acme-pos-feed-rollup-611" failed
   The platform ran this automation on its schedule and the run did not
   finish. ... The script reported this failure as temporary, so there is
   nothing in it to fix yet; the next scheduled run will try again. You will
   not be emailed about further failed runs while it keeps failing; you will
   be emailed when a run of it next succeeds.

posted to ops-events at 09:50
   The scheduled automation "acme-pos-feed-rollup-611" recovered
   Run dpx_191406aa… of this automation succeeded. It had been failing since
   2026-10-30 09:30 UTC, for 19 minutes, and 2 runs failed in that time. The
   first failed run was dpx_8539ce5b…. A succeeded run does not redo what the
   failed runs left undone unless the script does; check the runs if that
   matters.
   Cause: transient

Two runs failed and one message went out for them; the run that succeeded sent the second. The same pause tripped the webhook alert for a silent source on pos-sales, which posted a warning twenty minutes after the last event and a resolved post when the feed resumed, as 607 describes.

What a failure says about itself

Every failed run records its cause and whether running it again unchanged should succeed. That is the first thing the person reading the message needs to know: fix the script, or wait for the service.

What a failure says about itself

CauseWhat failedExpected to pass next time
scriptThe script itself: an evaluation error, fail(), an argument a call refused, a step or time limit.No
upstreamA service the script called timed out, dropped the connection, or answered its last call with a 5xx or 429 just before the script failed.Yes
transientThe script said its failure was temporary, as the roll-up above does.Yes
memoryThe run held more than its memory budget.No
worker lostThe servers running it kept stopping without a result until its take-overs were spent.No
platformThe run’s session or its script could not be opened.No
state conflictAnother run of the same automation saved its state first. The outputs stand.Yes

The platform never runs a failed run again on its own, whatever the cause: a run that already queried or wrote must not be replayed on the chance its last call was a passing fault. Expected to pass means the next fire, or whoever runs it again, should get past it. When three or more runs in a row fail on the same error, the owner’s email says the script needs correcting rather than waiting.

What is retried before a run fails

Some faults are over in seconds, and a run should not fail because of them. Three kinds are retried inside the run, within its deadline, before anything counts as a failure.

What is retried inside a run, before anything fails

A service that says it is busy
A 429, or a 502, 503, or 504 to a read, is waited out for the interval the service asked for, or 1, 2, then 4 seconds, and called again, at most three times and never past the run’s deadline. Each wait is a line in the log.
A warehouse read that failed for a temporary reason
Issued again after 1, 2, then 4 seconds, at most three times. A failure that is the script’s own, a missing column or a syntax error, is never retried.
A run that could not start
When the platform could not open the run’s session or read its script, the run goes back on the queue with a short backoff. Nothing it did is repeated, because it did nothing.

The agent hears about it too

The owner may work through an agent all day and open neither email nor the portal. The platform tells the agent instead, at the start of the next session.

The briefing at the start of the next session

What the agent calls. This is the exchange the agent has with Plexara on your behalf, shown for the technical reader. You ask in plain language; you never type any of it.

platform_info

-> failing_automations
     name                  acme-pos-feed-rollup-611
     run_id                dpx_8539ce5b…
     cause                 transient       retryable  true
     consecutive_failures  1               new        true
     scheduled             true
     last_succeeded_at     2026-10-30T09:20:13Z
     error                 no point-of-sale events arrived in the ten minutes
                           before 2026-10-30T09:30:00Z; the pos-sales feed has not published

   agent_instructions  This response carries a failing_automations list. It is
                       addressed to them, not to you. Relay it before you start
                       on their request, in your own words, and let them decide
                       what to do about it.

The first call of every session lists the automations the person owns whose latest run failed: the run to open, its cause and whether a retry should help, the error’s last line, how many runs in a row have failed, and whether it is scheduled. The agent relays it before anything else. An automation stays on the list at every session start until a run of it succeeds or it is taken out of service, so the owner who works through an agent and reads neither email nor the portal still hears about it.

The end of the series

The demo tenant’s roll-up failed for nineteen minutes, sent one message when it started failing and one when it recovered, and its owner’s agent was told about it in between.

That closes the 600 series. A script the agent wrote in 602 now runs by hand, on a schedule, once per event, or once per request, under the authority of the person who saved it, and tells the right people once, in plain words, when it stops working and when it starts again.

Key terms

Four terms cover what happens when an automation fails.

Key Terms

Incident
A failing automation, from the failed run that opens it to the successful run that closes it. One failure message and one recovery message.
Run failures
The setting under Admin > Settings that names the channels every failing automation posts to, beside its owner’s email.
Cause
What a failed run says failed: the script, a service it called, memory, the platform, or a state conflict.
Retryable
Whether running the same version again unchanged is expected to succeed. It never makes the platform run it again on its own.

Related reading

governance
Governance

403 - Sharing prompts, and closing the loop with feedback

A procedure is only worth as much as the people who can run it. Plexara distributes a prompt two ways: a direct share to the teammates or teams you name, or a promotion to a whole role or company through the admin review queue. A shared prompt is live, not a copy. Feedback threads then carry corrections back, with a validation step and a path into the knowledge catalog, and the deprecate-and-supersede lifecycle retires old versions cleanly.

Governance

505 - Next month’s file

The new sheet arrives. Replacing the file’s content writes a new revision, and the registered table keeps reading the old one until it is registered again under the same name; the Scratch Tables page says so. This lesson covers the two cases that look alike and behave differently, moving the table forward, unregistering, what deleting the file does, saving the monthly procedure as a prompt, and the point at which a monthly file needs more than a join, which is where the 600 series begins.

Governance

605 - What a run may do, and the record it leaves

A run presents the roles its author held at the save, every call is authorized at that moment, and narrowing the persona takes effect on the next run. A save requires one format, work in main(), the structural rules, and tests that pass, reach the code, and read the data, and refuses a credential-shaped literal. A new version is replayed against recent successful runs, and one that changes what the automation does waits for the person’s agreement to a plain-language summary. The dialect has no network, no filesystem, no clock, and no imports beyond pinned libraries, so everything a script does is a platform call audited under the script’s own identity. The lifecycle, who sees what, state and checkpoints on a failed run, ownership and an administrator’s transfer, and the administrator’s view of every script and every run.