Always run (cleanup)
When a step fails, the run stops and the steps after it don't run. A step marked Always run still does, so test data is cleaned up whatever happened.
Example flow
examples/Help/always-run.clem.json creates a cart, does some work and deletes the cart in an Always run step. Set $simulateFailure to true in Variables and run it: the work fails, and the cleanup still runs.
Turning it on
Click the shield button on any step (or tick Always run, even after an earlier step failed in the request editor). The step then shows "always run".


How it behaves
- In a passing run, an Always run step runs like any other.
- Its run conditional still applies. Give it
flowRun.failedto run only after a failure. - A failure inside it fails the run, and the next Always run steps still run.
- Stop ends the run at once, Always run steps included.
- In a data-driven run, every row runs its own.
flowRun
In code and run conditionals, flowRun says how the run went so far:
| Field | Value |
|---|---|
flowRun.failed | true once a step failed |
flowRun.status | "passed" or "failed" |
flowRun.failedSteps | [{ index, name, message }] |
// Runs even when a step before failed: flowRun says how the run went.
const r = await http({ method: "DELETE", url: $baseUrl + "/carts/1" });
log("deleted the test cart: " + r.status);
if (flowRun.failed) log("cleaned up after: " + flowRun.failedSteps.map((s) => s.name).join(", "));
(dummyjson.com doesn't keep the carts it creates, so the example deletes cart 1. Against your own API, delete "/carts/" + $cartId.)
Put cleanup steps at the end, and make each one safe to run when the data was never created: check the variable first (if ($cartId) { … }), or give the step the run conditional $cartId.