# Warnings

Canonical URL: https://developers.iagenify.com/sdk/workflows/warnings/
Language: en

A step can succeed and still have something to say. Warnings are per step, they never fail a run, and they are usually the first sign of a chain drifting.

Status: per step · never fail a run · worth surfacing

```javascript
for (const step of run.data.steps) {
  if (step.warnings?.length) console.warn(step.id, step.warnings);
}
```

## What produces one {#kinds}

| Situation | Typically |
| --- | --- |
| A result was clipped | A step returned more than a run carries. |
| A value was not the shape expected | A template read something that was not there. |
| A service answered partially | Part of the work was done. |
| A setting was not honoured | The step asked for something the service does not do. |

> **A warning is the thing that explains a later failure**
>
> A step that clipped its output succeeds; the step reading it fails two steps later on a value that is not there. Reading warnings is how that becomes one problem instead of two.

## Surface them in the run {#surfacing}

```javascript
const problems = run.data.steps
  .filter((s) => s.warnings?.length)
  .map((s) => `${s.id}: ${s.warnings.join("; ")}`);

if (problems.length) notify(problems);
```

## runStep() reports them too {#runstep}

Testing a step shows its warnings before the chain is deployed — which is the cheapest place to notice one.

## They are not errors {#not-errors}

`error` is a step that failed. `warnings` is a step that worked and has a reservation. Treating one as the other makes a run look broken or makes a real problem invisible.

- [data](/sdk/ref/workflow-run/data): Where they live.
- [Errors](/sdk/workflows/errors): The other half.

```python
for step in run.data["steps"]:
    if step.get("warnings"):
        print(step["id"], step["warnings"])
```

```python
problems = [f"{s['id']}: {'; '.join(s['warnings'])}" for s in run.data["steps"] if s.get("warnings")]

if problems:
    notify(problems)
```
