> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wherobots.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Monitor and recover

> Inspect scheduled runs, recover unprocessed windows, and resume disabled schedules.

## Read run history

A task run records an execution attempt or an outcome without execution, such as a skipped or missed time. Script execution uses a Job Run for compute.

Open a schedule in [**Scheduled Tasks**](https://cloud.wherobots.com/scheduled-tasks) and inspect its run history. Review the time and window, source, outcome, execution details, and cost. Expand an entry to see earlier attempts.

![Run history filtered to Needs recovery, showing the 1:09 PM to 1:24 PM PST window expanded with 2 attempts: a rerun waiting to start and the earlier scheduled attempt that failed](https://mintcdn.com/wherobots/Me_qzO_IbxOjqKzV/images/develop/task-schedules/monitor-and-recover/needs-recovery.png?fit=max\&auto=format\&n=Me_qzO_IbxOjqKzV\&q=85\&s=302392b46878077d19888db395abfc7d)

Needs recovery, with a rerun in progress above the failed scheduled attempt

| Task run state | Meaning |
| - | - |
| `PENDING`, `SUBMITTED` | Accepted or waiting to start. |
| `RUNNING` | Execution is in progress. |
| `CANCELLING` | Cancellation has been requested. Wait for the terminal outcome. |
| `SUCCEEDED` | Execution completed successfully. |
| `FAILED` | Execution or admission failed. Inspect `failureClass` and details, for example `USER_CODE` for a script error. |
| `TIMED_OUT` | Execution exceeded its time limit. |
| `CANCELLED` | Execution was cancelled. |
| `REJECTED` | Input validation rejected the run before compute launched or was billed. |
| `SKIPPED` | No execution launched: the previous scheduled run was still active (overlap), or the entry records a gap after an edit, a pause, or an automatic disable. Inspect the reason. |
| `MISSED` | A scheduled tick passed without a recorded execution. No compute launched. |
| `UNKNOWN` | The outcome could not be determined. |

A scheduled time that passes without a run appears as `MISSED` after a delay. Missed-time detection doesn't run while a schedule is paused, auto-disabled, or archived.

## Who can manage a schedule

Only the schedule's execution identity or an Organization administrator can use **Run now**, **Rerun**, **Pause**, **Resume**, or **Archive**. Other Organization members can view the schedule, but these controls are unavailable to them.

New schedules run as you unless an administrator selects a service principal. A service principal is recommended for production work so execution does not depend on an employee's account remaining active.

Only Organization administrators can select a service principal, and the Organization must have service principal access. You cannot assign another human as the execution identity. You can't edit a schedule that runs as another person. An administrator can reassign it to a service principal and then edit it. An administrator can also reassign a service-principal schedule to themselves.

If the script is in a person's My Files, reassigning the schedule to a service principal also requires changing its script location to `data/shared/` or a storage integration in the same edit. The **Select script file** picker opens on **My Files** even when **Run as** is a service principal; the ownership check happens on save. Saving with a person's My Files script fails with:

> The script (definition.uri) must be in the My Files of the principal that runs it. Service principals can't run scripts from a person's My Files.

See [Store the script](https://docs.wherobots.com/develop/task-schedules/create-a-schedule.md#store-the-script) for storage choices.

## Edit or stop scheduling

Open the schedule's configuration and choose **Edit configuration**, then **Save changes**. See [Processing windows](https://docs.wherobots.com/develop/task-schedules/scripts-and-windows.md#processing-windows) for which edits change execution and how they affect the next window. For the API, use `PATCH /triggers/{triggerId}` with the current `version`. To change inputs, follow [Change script inputs](#change-script-inputs): a supplied input map replaces the whole stored map.

Use **Pause** to stop future scheduled execution while allowing active runs to finish. The API request is `POST /triggers/{triggerId}/pause`; it needs no version. Use **Resume** (`POST /triggers/{triggerId}/resume` with the current `version`) to begin future scheduling again. Resume clears the failure counter and auto-disable state and starts a new [epoch](https://docs.wherobots.com/develop/task-schedules/scripts-and-windows.md#processing-windows). It does not replay a deliberately paused period. Runs dispatched before the reset cannot change the new failure streak.

## Read schedule status

The API returns these fields from `GET /triggers/{triggerId}`. In the Cloud UI, the status badge shows **Active** for an active schedule, and **Next run** shows its next scheduled time.

| Field | Description |
| - | - |
| `state` | `ACTIVE`, `PAUSED`, `AUTO_DISABLED` (stopped after repeated failures), or `ARCHIVED`. The `paused` request field doesn't appear in the response; read `state` instead. |
| `runAs` | The principal that task runs execute as. Task runs report the same principal as `runAsId`. |
| `nextFireTime` | The next scheduled time. It is `null` while the schedule is paused or disabled. It is also `null` while `converged` is `false`, for a few seconds after you create, edit or resume an active schedule. |
| `converged` | Whether the scheduler has picked up the schedule's current configuration. To read `nextFireTime` after a change, poll `GET /triggers/{triggerId}` until `converged` is `true`. |
| `version` | The schedule's current version. Send it when you update, resume or archive the schedule. |

## Change script inputs

To change inputs through the API or MCP, read the schedule first. `task.inputs` holds fixed inputs shared by every run. `triggerInputs` holds inputs that complete the fixed map. `GET /triggers/{triggerId}` returns both stored maps without filling in defaults.

> [!WARNING]
>
> A supplied input map replaces the whole stored map. It does not merge with existing inputs. Sending only `{"args": ["--mode", "report"]}` removes other keys from that map, including runtime, timeout, and environment settings. Later runs then use the [defaults](https://docs.wherobots.com/develop/task-schedules/scripts-and-windows.md#script-inputs) for the removed keys: your Organization's default runtime and runtime version, a `timeoutSeconds` of `3600`, and no `environment` settings.

To change one key, copy the complete stored map, change that key, and send the full replacement with the version from the same read. Leave unrelated fields out of the request, including `triggerConfig`, so an input edit doesn't submit a new schedule configuration.

Edit the key in the map that currently holds it: `task.inputs` for fixed inputs, or `triggerInputs` (`trigger_inputs` in MCP) for completion inputs. Replace that whole map. See [Processing windows](https://docs.wherobots.com/develop/task-schedules/scripts-and-windows.md#processing-windows) for how an input edit affects the next window.

> [tab] REST API
>
> Use the API URL and authentication setup from [Create a schedule](https://docs.wherobots.com/develop/task-schedules/create-a-schedule.md#configure-the-schedule). Set `TRIGGER_ID` to the schedule you want to edit. These commands require `jq`.
>
> ```bash theme={"system"}
> TRIGGER_ID="YOUR-TRIGGER-ID"
> SCHEDULE=$(curl -sSf -H "X-API-Key: $WHEROBOTS_API_KEY" \
>   "$API/triggers/$TRIGGER_ID")
> printf '%s\n' "$SCHEDULE" | jq '.task.inputs'
> ```
>
> For example, a schedule with these stored inputs prints:
>
> ```json theme={"system"}
> {
>   "args": [
>     "--mode",
>     "preview"
>   ],
>   "runtime": "small",
>   "version": null,
>   "environment": {
>     "sparkConfigs": {
>       "spark.sql.shuffle.partitions": "8"
>     }
>   },
>   "timeoutSeconds": 1800
> }
> ```
>
> Build the request from the `.task.inputs` you read, not from this example. Change only `args`. Preserve every other key and literal null, and use the version from the same response:
>
> ```bash theme={"system"}
> if UPDATED=$(printf '%s\n' "$SCHEDULE" | jq '{
>   version: .version,
>   task: {inputs: (.task.inputs | .args = ["--mode", "report"])}
> }' | curl -sS --fail-with-body -X PATCH \
>   -H "X-API-Key: $WHEROBOTS_API_KEY" \
>   -H "Content-Type: application/json" \
>   --data-binary @- "$API/triggers/$TRIGGER_ID"); then
>   printf '%s\n' "$UPDATED" | jq '.task.inputs'
> else
>   printf '%s\n' "$UPDATED"
> fi
> ```
>
> If the request fails, for example with a `409`, the command prints the API's error message instead.
>
> For the example inputs above, the updated schedule's `task.inputs` keeps every other setting:
>
> ```json theme={"system"}
> {
>   "args": [
>     "--mode",
>     "report"
>   ],
>   "runtime": "small",
>   "version": null,
>   "environment": {
>     "sparkConfigs": {
>       "spark.sql.shuffle.partitions": "8"
>     }
>   },
>   "timeoutSeconds": 1800
> }
> ```
>
> To clear arguments while keeping other settings, change the assignment in `jq` to `.args = []`. To remove a fixed key intentionally, delete it from the copied map before building the request, for example with `del(.runtime)`. Don't use null to remove a key.

> [tab] MCP
>
> Call `get_schedule` with the schedule's `trigger_id`. Copy the complete returned `task.inputs` map and change only `args`. Then call `update_schedule` with only `trigger_id`, the `version` from that same response, and the full map as `task_inputs`.
>
> For example, if `get_schedule` returns version `1` and the stored inputs from the REST example, the tool arguments are:
>
> ```json theme={"system"}
> {
>   "trigger_id": "YOUR-TRIGGER-ID",
>   "version": 1,
>   "task_inputs": {
>     "args": ["--mode", "report"],
>     "runtime": "small",
>     "version": null,
>     "environment": {"sparkConfigs": {"spark.sql.shuffle.partitions": "8"}},
>     "timeoutSeconds": 1800
>   }
> }
> ```
>
> The schedule's `version` is the top-level argument. The `version` inside `task_inputs` is the runtime version input. Use the version and input map you read, not the ones in this example. `update_schedule` sends the same request as the REST example, and the returned `task.inputs` matches its result. Set `args` to `[]` in the copied map to clear arguments.

### Distinguish omission, null, and empty inputs

These rules apply to schedule updates. Clearing a map or removing a key must still leave a valid execution configuration.

| Value in the update | REST API | MCP `update_schedule` |
| - | - | - |
| Input map omitted | Omit `task.inputs` or `triggerInputs` to preserve that map. | Omit `task_inputs` or `trigger_inputs` to preserve that map. |
| Outer null | `task: null` and `triggerInputs: null` leave those fields unchanged. `task.inputs: null` is invalid. | `task_inputs: null` and `trigger_inputs: null` leave those maps unchanged. |
| Empty object `{}` | `task.inputs: {}` or `triggerInputs: {}` clears that map. | `task_inputs: {}` or `trigger_inputs: {}` clears that map. |
| Nested null, such as `{"runtime": null}` | Stores that key with a null value as part of the replacement map, not a deletion or no-op. `runtime` and `version` accept null; `args` (a list), `timeoutSeconds` (an integer), and `environment` (an object) reject null. | Preserves explicit nested nulls and sends them to REST. The API rejects null for `args`, `timeoutSeconds`, and `environment` even though the tool's input types permit it. |
| Key omitted from a supplied map | Removes that key from the stored map. | Removes that key from the stored map. |

Input objects and arrays are whole replacements, not recursive merges. If you edit `environment`, preserve its other settings too. `environment` must be an object, not null.

A key present in `task.inputs` is fixed, even when its value is null. You cannot also set that key in `triggerInputs`. To make a fixed key available as a completion input, omit it from the full replacement of `task.inputs`. Setting the fixed key to null does not release it. Read `task.openProperties` and `task.inputSchema` to inspect available inputs.

On a `409`, see [Handle version conflicts](#handle-version-conflicts) and reapply your edit to the newly fetched map.

## Handle version conflicts

Before a versioned update, resume, or archive request, read `GET /triggers/{triggerId}` and review the current configuration and `version`. Send that version with your request. Treat the version as an opaque concurrency token: lifecycle actions and failure-counter updates can change it too. It is not a version of the script's contents.

If the request returns `409`, read the schedule again. Compare it with the configuration you intended to change, re-evaluate the action, and retry with the latest version only if it is still appropriate. Avoid an unconditional retry loop that overwrites another person's edits.

## Recover a window

See [Who can manage a schedule](#who-can-manage-a-schedule) for access requirements.

**1. Find the window**

Select **Needs recovery** in run history to find unprocessed work, including failed, timed-out, rejected, missed, or skipped entries, plus reruns still in progress. Use **All** to inspect the rest of the history.

**2. Fix the cause**

Inspect the reason and fix the script, permissions, or configuration before retrying.

**3. Rerun the window**

Choose **Rerun** on a terminal entry. Review the original window and confirm.

**4. Verify the new attempt**

Follow the new attempt to completion. Earlier attempts remain in history.

A rerun uses the original window and the current script definition, inputs, and execution identity. It is billed as a normal run. The source file is not pinned, so a rerun cannot promise historical code replay. Use [repeatable, window-based output writes](https://docs.wherobots.com/develop/task-schedules/scripts-and-windows.md#write-repeatable-outputs) to avoid duplicates.

You can rerun a successful entry too, and reruns are available while a schedule is paused or auto-disabled. Different historical windows can run concurrently, but an active attempt for the same tick or gap must finish before another can start. Archived schedules cannot run again. **Run now** creates a separate manual run and does not repair the journal.

## Failure emails

Scheduled failures caused by user code, timeout, rejected configuration, or an unclassified failure send notifications. Platform failures, quota rejections, cancellations, and skipped ticks do not send these failure emails. Manual-run and rerun failures do not send them either.

Wherobots sends these emails to the schedule's explicit notification contacts and its active human execution identity. If neither provides a recipient, it uses Organization administrators. A failure that disables the schedule sends a combined failure and auto-disable notice with a link to review it.

## Automatic disabling

Wherobots automatically disables a schedule after **5 consecutive counted failures**. The counter counts scheduled user-code, timeout, configuration, and unclassified failures in completion order. Platform failures, quota rejections, and cancellations leave it unchanged.

Among runs, only scheduled runs affect the counter. A successful scheduled run clears it. Manual runs and reruns leave it unchanged, whether they succeed or fail. No successful run resumes a paused or auto-disabled schedule. See [Edit or stop scheduling](#edit-or-stop-scheduling) for how **Resume** resets scheduling and the counter.

To recover an auto-disabled schedule, inspect its failing run, correct the problem, and test with **Run now** if needed. Then choose **Resume** to restart scheduled execution. Unlike a deliberate pause, the time the schedule spent auto-disabled is recorded as a gap after you resume, so you can rerun it. Rerun any recorded windows that still need recovery.

## Cancel or archive

Use **Cancel** on an active run to request cancellation, then check its terminal status. Cancellation does not itself pause future scheduling.

Use **Archive** (`DELETE /triggers/{triggerId}?version=N` in the API) to stop future scheduling and request cancellation of active runs, including manual runs and reruns. Configuration and run history remain available in the **Archived** view. An archived schedule cannot be edited, resumed, or rerun. Create a new schedule if the work needs to restart.

## Troubleshooting

* **Run now, Rerun, or Resume is unavailable:** check the execution identity and the displayed reason. A deleted execution identity or unavailable service-principal execution prevents these actions. Ask an Organization administrator to review access and the schedule's **Run as** setting. Archived schedules cannot be resumed.
* **The script path was accepted, but the run failed:** create-time validation does not prove that the object exists. Check the file at the saved S3 location and confirm the execution identity can read it. A missing path can fail at run time as a user-code error.
* **The next scheduled time is unavailable after a change:** allow the scheduler to apply the configuration. The API exposes this as [`converged`](#read-schedule-status).
* **A run was rejected for quota:** inspect Organization capacity before rerunning the window. Quota rejections do not increment the failure counter.
* **A successful Run now didn't restart an auto-disabled schedule:** manual runs don't change the failure counter or the auto-disable state. Choose **Resume** to restart scheduling.

## Next steps

> [card] [Scripts and processing windows](https://docs.wherobots.com/develop/task-schedules/scripts-and-windows.md)
>
> Make scripts safe to rerun for the same window.

> [card] [Create a schedule](https://docs.wherobots.com/develop/task-schedules/create-a-schedule.md)
>
> Set up a new schedule in Cloud or through the API.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.