Skip to content

A task passed only on a later try

warning: web#test: this task failed, then passed on try 2 of 3, so it may be flaky
hint: Look for what changes between runs, such as timing, test order, shared state or the network, so it passes the first time.

The task has retries in axle.toml. It failed, Axle ran it again, and a later try passed, so the run carries on as if it had passed the first time. The output of every try is in the task’s output above the warning.

A task that fails and then passes with nothing changed is flaky: something besides its inputs decides whether it passes. Retries keep a flaky task from failing CI, but each retry costs time, and the next failure may be a real one that a retry hides.

Read the output of the failed try to see which test failed, then look for what differs between runs:

  • tests that depend on timing, such as a fixed wait or a timeout that’s too short on a busy machine;
  • tests that depend on the order they run in, or on state another test leaves behind;
  • the network, a shared database or a port another task uses at the same time.

Once the task passes the first time, lower its retries or remove them.