On save
One code, invalid_workflow (400), and a message naming the step and the problem. One code because there is one answer: fix the definition.
| Refused | Because |
|---|---|
| An unknown step type | The message lists the 23. |
| A duplicate or malformed step id | Ids are what edges and templates name. |
| More than 30 steps | The ceiling. |
| A missing required configuration | Named per type — a model, a URL, a storage, a path. |
| A template naming an unknown step | It would read nothing. |
| A template naming a step that is not upstream | It would always read nothing. |
| No edge from the trigger, or several | A workflow has one start. |
| A cycle | The graph must be acyclic. |
| An unreachable step | Named, so you can see what was left dangling. |
| A condition without both branches | Every path must be one somebody wrote. |
A switch missing a case edge or default | Same reason. |
| A merge with fewer than two inputs | Merging one thing is not merging. |
An unknown tool on agent.run | The message lists the ones that exist. |
An action outside the account with no human step upstream | There is nobody to ask during a run. |
Why it is all on save
A workflow runs with nobody watching. A refusal while you are writing it is a message you read; the same problem at run time is a failed step in a log at three in the morning.
At run time
| Code | Where | When |
|---|---|---|
| run_not_waiting | resume() | The run is not stopped at a human step. |
| run_not_retryable | retry() | It is still going, or a step before the chosen one did not succeed. |
| step_not_found | resume() · runStep() | No such step. |
| step_not_executable | runStep() | A human step has nothing to execute. |
| timeout | wait() | The ceiling passed. The run keeps going. |
A step that fails is not an exception
It is recorded on the step, with its message, and the run's status becomes failed. Nothing throws — reading run.data.status is how a failure is noticed.
await run.wait();
if (run.data.status === "failed") {
const failed = run.data.steps.find((s) => s.status === "failed");
console.error(failed.id, failed.error);
await run.retry();
}run.wait()
if run.data["status"] == "failed":
failed = next(s for s in run.data["steps"] if s["status"] == "failed")
print(failed["id"], failed["error"])
run.retry()