# checkly rca - Checkly Docs

> Trigger and retrieve AI-powered root cause analyses for error groups.

Source: https://www.checklyhq.com/docs/cli/checkly-rca/

---

Back to top
- Usage
- Subcommands
- checkly rca run Run Options
- Run Examples

- checkly rca get Get Options
- Get Examples

- RCA Output
- Related Commands

CLI Commands

# checkly rca

Trigger and retrieve AI-powered root cause analyses for error groups.

Available since CLI v7.8.0.

The `checkly rca` command lets you trigger and retrieve [AI-powered root cause analyses (RCA)](https://www.checklyhq.com/docs/resolve/ai-root-cause-analysis/overview/) for error groups directly from the terminal. An RCA examines an error group and returns a classification, root cause explanation, user impact assessment, and suggested code fixes when available.

Prerequisites

Before using `checkly rca`, ensure you have:

- Checkly CLI installed

- Valid Checkly account authentication (run `npx checkly login` if needed)

- A Checkly plan that includes root cause analysis

- Rocky AI enabled for the account, to run new analyses with `checkly rca run`. An account Owner turns on **Enable Rocky AI** in the [Rocky AI settings](https://app.checklyhq.com/accounts/rocky-ai).

For additional setup information, see [CLI overview](https://www.checklyhq.com/docs/cli/overview).

Existing root cause analysis results are also available via [`checkly checks get`](https://www.checklyhq.com/docs/cli/checkly-checks/#checkly-checks-get). Use `checkly rca run` to trigger a new analysis for an error group that doesn’t have one yet.

## Usage

Terminal

```
npx checkly rca [arguments] [options]
```

## Subcommands

Subcommand Description

`run` Trigger a root cause analysis for a check or test session error group.

`get` Retrieve a root cause analysis by ID.

## `checkly rca run`

Trigger a new root cause analysis for a check or test session error group. The analysis runs asynchronously — use `--watch` to wait for the result in your terminal.
**Usage:**
Terminal

```
npx checkly rca run [options]
```

**Options:**
Option Required Description

`--error-group, -e` yes* The check error group ID to analyze.

`--test-session-error-group, -te` yes* The test session error group ID to analyze.

`--user-context` - Extra context to pass into the root cause analysis.

`--watch, -w` - Wait for the analysis to complete and display the result.

`--output, -o` - Output format: `detail`, `json`, or `md`. Default: `detail`.

*Pass either `--error-group` or `--test-session-error-group`.

### Run Options

string

The check error group ID to trigger the analysis for. You can find error group IDs in the output of [`checkly checks get`](https://www.checklyhq.com/docs/cli/checkly-checks) when viewing a check with errors. **Usage:** Terminal

```
npx checkly rca run --error-group=
npx checkly rca run -e
```

string

Available since CLI v8.0.0.

The test session error group ID to trigger the analysis for. You can find these IDs in the output of [`checkly test-sessions get`](https://www.checklyhq.com/docs/cli/checkly-test-sessions). **Usage:** Terminal

```
npx checkly rca run --test-session-error-group=
npx checkly rca run -te
```

string

Available in CLI v8.5.0+.

Extra context to pass into the root cause analysis. Use this to add details the error group does not contain, such as recent deploy changes or known service incidents. **Usage:** Terminal

```
npx checkly rca run --error-group= --user-context="Started after the checkout deploy"
```

boolean

default: "false"

Wait for the analysis to complete and display the full result. Without this flag, the command returns immediately with the RCA ID and a pending status. Only works with `--output detail`. **Usage:** Terminal

```
npx checkly rca run --error-group= --watch
npx checkly rca run -e -w
```

string

default: "detail"

Set the output format. Use `json` for programmatic access or `md` for markdown. **Usage:** Terminal

```
npx checkly rca run --error-group= --output=json
npx checkly rca run -e -o md
```

### Run Examples

Terminal

```
# Trigger an RCA and wait for the result
npx checkly rca run --error-group=err-abc-123 --watch

# Trigger an RCA without waiting
npx checkly rca run --error-group=err-abc-123

# Trigger an RCA for a test session error group
npx checkly rca run --test-session-error-group=err-abc-123

# Add extra context for the analysis
npx checkly rca run --error-group=err-abc-123 --user-context="Started after the checkout deploy"

# Get the result as JSON
npx checkly rca run --error-group=err-abc-123 --output=json
```

## `checkly rca get`

Retrieve an existing root cause analysis by its ID. If the analysis is still generating, use `--watch` to wait for completion.
**Usage:**
Terminal

```
npx checkly rca get [options]
```

**Arguments:**
Argument Description

`id` The RCA ID to retrieve.

**Options:**
Option Required Description

`--watch, -w` - Wait for the analysis to complete if still generating.

`--output, -o` - Output format: `detail`, `json`, or `md`. Default: `detail`.

### Get Options

boolean

default: "false"

Wait for the analysis to complete if it is still generating. Without this flag, the command returns the current status immediately. Only works with `--output detail`. **Usage:** Terminal

```
npx checkly rca get --watch
npx checkly rca get -w
```

string

default: "detail"

Set the output format. Use `json` for programmatic access or `md` for markdown. **Usage:** Terminal

```
npx checkly rca get --output=json
npx checkly rca get -o md
```

### Get Examples

Terminal

```
# Retrieve a completed RCA
npx checkly rca get rca-xyz-789

# Wait for a pending RCA to complete
npx checkly rca get rca-xyz-789 --watch

# Get the result as JSON
npx checkly rca get rca-xyz-789 --output=json
```

## RCA Output

A completed root cause analysis includes:

- **Classification** — the category of the error

- **Root cause** — explanation of what caused the error

- **User impact** — how the error affects end users

- **Code fix** — suggested fix when available

- **Evidence** — supporting artifacts from the analysis

- **Reference links** — relevant external resources

## Related Commands

- [`checkly checks`](https://www.checklyhq.com/docs/cli/checkly-checks) - List, inspect, and analyze checks (includes error groups)

- [`checkly test-sessions`](https://www.checklyhq.com/docs/cli/checkly-test-sessions) - Inspect recorded test sessions and test session error groups

Was this page helpful?

[Suggest edits](https://github.com/checkly/docs/edit/main/cli/checkly-rca.mdx)[Raise issue](https://github.com/checkly/docs/issues/new?title=Issue%20on%20docs&body=Path:%20/cli/checkly-rca)

[checkly pw-test Previous](https://www.checklyhq.com/docs/cli/checkly-pw-test)[checkly runtimes Next](https://www.checklyhq.com/docs/cli/checkly-runtimes)

[x](https://x.com/checklyhq)[github](https://github.com/checkly)[linkedin](https://linkedin.com/company/checkly)

[Powered by This documentation is built and hosted on Mintlify, a developer documentation platform](https://www.mintlify.com/?utm_campaign=poweredBy&utm_medium=referral&utm_source=checkly-422f444a)
