---
url: https://docs.puppetflow.com/reference/flow-api/debugging.md
---
# Debugging

Interactive breakpoints for step-by-step flow debugging.

## `$breakpoint(label?, context?)`

Set an interactive breakpoint. When breakpoint mode is enabled, the run pauses and a REPL opens where you can run arbitrary JavaScript, inspect variables, take screenshots, and continue when ready.

```js
await $breakpoint('after-login', { user: username, cookies: cookieCount });
```

Breakpoint mode is enabled with `ENABLE_BREAKPOINT=true` or automatically by the `php artisan flow:run` command. Otherwise, `$breakpoint` calls are skipped.

### REPL commands

| Command | Description |
| --- | --- |
| `continue` or `c` | Resume the run. |
| `screenshot` or `s` | Take a debug screenshot (saved with timestamp). |
| `url` or `u` | Print the current page URL. |
| `help` | List available commands. |
| Any JS expression | Evaluate in the flow context with access to all globals and helpers. |

### Context

The `context` parameter lets you expose additional variables inside the REPL:

```js
const rows = await $bridgeEvaluate(() => document.querySelectorAll('tr').length);
await $breakpoint('check-table', { rows, expectedCount: 10 });
// In the REPL: `rows` and `expectedCount` are available
```

All standard globals (`$page`, `$browser`, `$input`, `$context`, `$client`) and helper functions (`$sleep`, `$fillInput`, `$gotoUrl`, `$gotoTab`, `$screenshot`, etc.) are available in the REPL.
