# Errors and debugging

> Read the editor console, recognise the common errors and their real causes, and find out why a script runs but draws nothing.

When a script fails, the editor's **console** says what went wrong and, when it can, which line. Warnings (a script that runs but with a caveat) appear there too, along with any `alert()` events.

## Kinds of error

| Kind | Means | Usually |
| --- | --- | --- |
| Transpile | The code could not be understood | A typo, a missing bracket, wrong indentation |
| Runtime | It ran and then failed on some bar | Dividing by `na`, an array index out of range, a bad argument |
| Timeout | It did not finish in time | An unbounded loop |

Every runnable example in these docs reports errors the same way. Try breaking one:

```pine
//@version=6
indicator("Spot the mistake")
len = 14
r = ta.rsi(close, len)
plot(r, "RSI", color = color.purple)
hline(50)
```

Change `ta.rsi` to `ta.rsii` and press **Run** to see a real error message.

## Common errors and their real causes

**"Loop exceeded maximum iterations"** comes from a `while` or `for` loop that never ends. The engine stops it rather than hang the chart.

**"This feed cannot serve the '…' timeframe."** A `request.security` asked for less than five seconds. See [Multiple timeframes](/docs/timeframes).

**Indentation.** Blocks under `if`, `for` and functions are indented by four spaces (or one tab). A line indented by a different amount is a transpile error.

**Saved setting no longer exists.** A warning, not an error: an input you had customised was removed from the script. See [Inputs](/docs/inputs).

## It runs, but draws nothing

Work through these in order:

1. **Is the value ever not `na`?** Long lookbacks need history. Plot the raw series and look for a line.
2. **Is a `plotshape` series ever true?** Markers need `true` or a non-zero number. Plot the condition as a number (`plot(cond ? 1 : 0)`) to see.
3. **Is it on the right scale?** An oscillator with `overlay = true` draws its 0 to 100 values on a price chart where it is off screen. Remove `overlay`.
4. **Is the drawing only on the last bar?** `barstate.islast` objects appear at the right edge. Scroll there.
5. **Is the colour transparent?** `color.new(c, 100)` is invisible.

## Seeing values

- Plot it. A temporary `plot(x, "debug")` shows every bar's value in the indicator's legend as you move the crosshair. Put it in a pane script so it gets its own scale.
- A table on the last bar is a quick dashboard of current values; see [Drawings and tables](/docs/drawings).
- A label with `str.tostring(x)` shows a value at a specific bar.
- `alert("x = " + str.tostring(x))` writes to the console each time it runs.
