How to retry a failed workflow run
Resume a run that failed partway, without re-executing the steps that already succeeded.
Prerequisites
- The
runIdfrom a failure body, or a run you found in the history - A JWT access token with onboarding management permissions
export API="https://api.example.com/api"
export TOKEN="YOUR_ACCESS_TOKEN"
Steps
1. Find the run
Failure bodies carry the id directly:
{
"deviceId": "temp-sensor-001",
"failedStep": "create_asset",
"errorCode": "model_not_found",
"message": "Model 'm-1' was not found.",
"retryable": false,
"runId": "0198f3f2-1a2b-7c3d-9e4f-5a6b7c8d9e0f"
}
If you don't have it, search the history — newest first:
curl -s "$API/workflow-runs?subjectId=temp-sensor-001&outcome=failed&limit=5" \
-H "Authorization: Bearer $TOKEN" \
| jq -r '.items[] | "\(.runId) \(.workflowId) \(.failedStep) \(.errorCode)"'
2. Inspect what failed
export RUN_ID="0198f3f2-1a2b-7c3d-9e4f-5a6b7c8d9e0f"
curl -s "$API/workflow-runs/$RUN_ID" -H "Authorization: Bearer $TOKEN" \
| jq '{outcome, retryable, invokedBy, steps, resolvedInputs}'
steps shows each step's outcome in order, so you can see exactly where execution stopped.
resolvedInputs is the exact merged input set the run was armed with.
3. Fix the underlying cause
A retry re-runs the same recorded inputs. If the failure was terminal — a missing model, a conflicting client id — fix that first, or the retry fails identically at the same step.
Retryable failures (retryable: true, usually 503) generally need nothing but time.
4. Retry
curl -X POST "$API/workflow-runs/$RUN_ID/retry" \
-H "Authorization: Bearer $TOKEN"
No request body. The route accepts none, and reads no query overrides. The run is re-armed from its own recorded inputs and replays the original route's scope.
Verify it worked
The retry returns the workflow's normal success body — 201 or 200 for an activation. It also
writes a new run record referencing the one it re-drove:
curl -s "$API/workflow-runs?subjectId=temp-sensor-001&limit=1" \
-H "Authorization: Bearer $TOKEN" | jq '.items[0] | {runId, outcome, retryOfRunId}'
Steps carried over from the previous run are marked resumed: true in the new record's steps.
Variations
Retry a retry. Permitted. Each attempt writes its own record, chained by retryOfRunId.
Re-run instead of retrying. Issuing the original run request again also works — the steps are convergent. The difference is that a re-run starts from step 1 and writes an unrelated record, while a retry resumes and preserves the chain.
If it doesn't work
The retry route refuses rather than guessing. Each refusal means something specific:
| Status | Code | What it means |
|---|---|---|
404 | run_not_found | Unknown id, or the record aged out of the retention window |
409 | run_not_retryable | The run did not fail — only failed runs are retryable |
409 | run_inputs_unavailable | The record predates input recording |
409 | run_outputs_unavailable | The record predates produced-value recording |
409 | run_not_resumable | The workflow definition changed; recorded steps no longer match |
409 | workflow_not_registered | The workflow was removed from the deployment |
409 | provider_client_unresolvable | The subject's provider-client identity names no provider |
400 | workflow_input_missing | The workflow gained a required input since the run |
For run_not_resumable and workflow_not_registered, retrying is impossible by design — start a
fresh run instead.
See also
- Workflow Error Codes
- How workflows execute — why retry takes no input