# Errors

> How failures move through a workflow — the error port every node has, what the engine does when a node fails, how a run ends completed or failed, and what flow.try, retries and timeouts do and do not do.

Source: https://docs.sommatic.ai/en/workflows/errors/ (updated 2026-11-26)

Errors in Sommatic AI are part of the graph. A node that fails says so through its `error` port, and you decide what
happens next by connecting that port, or not.

## The error port

Almost every node in the [catalog](https://docs.sommatic.ai/en/nodes.md) declares an `error` port. When the node cannot do its work (the API
answered 500, the document had no text, the expression in a condition threw), it returns:

```json
{ "ok": false, "port": "error", "data": { "error": "…" } }
```

What happens next depends on the graph:

| The `error` port… | Result                                                                                                                  |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------- |
| has an edge       | The engine follows it. The next node receives the failed node's output as `$json`; its exact shape depends on the node. |
| has no edge       | That branch stops. If it was the last node of the run, the run ends `failed`.                                           |

Typical recovery branches open a task with [`human.task.create`](https://docs.sommatic.ai/en/nodes/human.task.create.md), send a notice, write
a status with [`integrations.mongodb.operation`](https://docs.sommatic.ai/en/nodes/integrations.mongodb.operation.md) or try an alternative
path.

## When a node raises an error

Sometimes a node does not return an envelope at all: its process fails, a required resource is missing or the
operator cannot be resolved. The engine records the node with status `error` and stops the run as `failed`, with the
message `Node <node_id> (<operator>) failed: …`.

## How a run ends

| Situation                                                                                              | Run status                                  |
| ------------------------------------------------------------------------------------------------------ | ------------------------------------------- |
| No more edges to follow and the last node did not leave through `error`                                | `completed`                                 |
| A node failed, its `error` edge led to recovery nodes, and the last node did not leave through `error` | `completed`                                 |
| The last node that ran left through `error`                                                            | `failed`                                    |
| A node raised an error the engine could not route                                                      | `failed`                                    |
| The run went over 100 steps                                                                            | `failed` (`Max step ceiling reached (100)`) |

The run result keeps an `outcome_category` (`success` or `error`) and, on failure, an `error_summary` with the
message.

## flow.try

[`flow.try`](https://docs.sommatic.ai/en/nodes/flow.try.md) marks the start of a scope: it passes its input to its only port, `do`, and the
engine registers the scope. The engine can send an error raised inside that scope to a catch node connected to the
try node's `catch` port, but `flow.try` does not declare that port, so the studio does not offer it. Handle failures
with the `error` port of each node.

## Retries

The engine does not retry nodes. Retries exist only inside the nodes that implement them:

- [`io.http`](https://docs.sommatic.ai/en/nodes/io.http.md) retries rate limits (`429`), server errors (`5xx`) and network failures, never other
  `4xx` responses, with at most 5 attempts.
- [`integrations.microsoft.azure.blob`](https://docs.sommatic.ai/en/nodes/integrations.microsoft.azure.blob.md),
  [`integrations.mongodb.operation`](https://docs.sommatic.ai/en/nodes/integrations.mongodb.operation.md) and
  [`ai.classify.triage`](https://docs.sommatic.ai/en/nodes/ai.classify.triage.md) honor **Retry On Fail** and **Max Retries** from the node's
  **Settings** tab.

Other nodes show those settings but ignore them. **Continue On Fail** is not applied by any node: connect the `error`
port instead.

## Timeouts

- **Timeout (ms)** in a node's settings (300000 by default) is honored by long-running operators such as extraction
  and inline code.
- [`workflow.chain`](https://docs.sommatic.ai/en/nodes/workflow.chain.md) in `sync` mode leaves through `error` when the sub-workflow goes
  longer than `timeout_ms` (30000 by default) without any sign of progress.

## Conditions that fail

When the condition of [`flow.if`](https://docs.sommatic.ai/en/nodes/flow.if.md) throws, the node leaves through `error` without data. Nodes on
that branch should read what they need with `$('Node label').item.json` instead of `$json`. More cases are in
[expression gotchas](https://docs.sommatic.ai/en/expressions/gotchas.md).

> **Tip: See exactly where it failed**
>
> Open the run from the **Runs** tab: every node shows its port, and the failed one shows its error. In the studio, the
> failed node is marked on the canvas and the debug console shows the error event.

## Next steps

- [Limits](https://docs.sommatic.ai/en/workflows/limits.md): Steps, retries, timeouts and body sizes.
- [Testing](https://docs.sommatic.ai/en/workflows/testing.md): Reproduce a failure with sample data.
- [Human in the loop](https://docs.sommatic.ai/en/human-in-the-loop.md): Hand failed cases to a person.
