> For the complete documentation index, see [llms.txt](https://docs.currents.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.currents.dev/ai/ai-in-the-dashboard/ai-failure-analysis.md).

# AI Failure Analysis

AI Failure Analysis shows the likely cause of a failed test and suggested fixes in the Currents dashboard

AI Failure Analysis shows the likely cause of a failed test, with suggested fixes, next to the test's results in the dashboard. An AI model writes it from the data Currents recorded for the test, so you start from a diagnosis instead of reading the error, steps and logs yourself.

AI Failure Analysis is available on every plan. An organization admin turns it on once for the whole organization. The same setting turns on [Explain this test](https://docs.currents.dev/ai/ai-in-the-dashboard/explain-this-test.md).

## Turn on AI Failure Analysis

AI Failure Analysis sends test data to an AI provider, so it needs your organization's consent.

1. Open the organization settings and select **AI and data**.
2. Turn on **AI assistance**.

Only organization admins can change this setting. Members who open a test before it is on see a note that asks them to contact an admin.

Turning **AI assistance** off stops AI Failure Analysis for everyone in the organization. Requests that are in progress fail. See the [AI terms](https://currents.dev/ai-terms) for how Currents and its AI providers handle the data.

## See why a test failed

1. Open a run and select a failed test.
2. In **Insights**, expand **Likely cause of the failure**.

Currents sends the request when you expand the card, and lists what the model checks while it works. When it finishes, the card title changes to the likely cause, and the card shows:

* The category of the failure: Network Error, Element Interaction, Assertion Failure, Timeout, Configuration Error, Syntax Error, Environment Error, Flaky Test or Other. Hover the category to see what it means.
* The root cause.
* Suggested fixes, each with a confidence level, and code when a fix needs it.

<figure><img src="https://3745692499-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FqmFDEiUa9mr11LUlxDnt%2Fuploads%2Fgit-blob-c0028acb4a69620d179f32e3c314ee7c619fe537%2Fai-failure-analysis-likely-cause.png?alt=media" alt="The Insights section of a failed test with Likely cause of the failure expanded: the card title states the cause, then an Assertion Failure category, the root cause, and two suggested fixes with confidence levels and a code snippet" width="720"><figcaption></figcaption></figure>

The card appears only for tests with a failed attempt. The analysis covers the failed attempt of the test you opened.

## What the model reads

The model works from the data Currents recorded for the test: the error and stack trace, the test steps, the console output and the commit. It does not read your repository.

When the failed attempt has a Playwright trace, the model also investigates the trace with read-only tools. It lists the actions, reads the network requests and response bodies around the failing step, and looks at the page snapshot and screenshots at the failure. The card lists each check while the model works. Credentials are removed from text before it reaches the model; screenshots are sent as images.

If the test has no trace, or the trace cannot be read in time, the model explains the failure from the error, steps and console output alone.

Each card shows when the result was generated and how long it took. Currents keeps the result, so the next person who opens the same test sees it without a new request. Copy a result to paste it into a pull request, an issue or an agent prompt.

## Ask your agent instead

To have an agent fix the failure in your code, connect it to Currents. The agent reads the same failure data, and also has your repository. See [Fix failing CI tests](https://docs.currents.dev/ai/agentic-testing/fix-failing-tests.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.currents.dev/ai/ai-in-the-dashboard/ai-failure-analysis.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
