---
title: Investigate Errors with Bits AI
description: >-
  Investigate Error Tracking issues with Bits Investigation to find the root
  cause and impact of an error.
breadcrumbs: Docs > Error Tracking > Investigate Errors with Bits AI
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Investigate Errors with Bits AI

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com, us2.ddog-gov.com

{% alert level="danger" %}
This product is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site.md). ({% placeholder "user-datadog-site-name" /%}).
{% /alert %}

{% /callout %}

{% callout %}
# Important note for users on the following Datadog sites: app.datadoghq.com, us3.datadoghq.com, us5.datadoghq.com, app.datadoghq.eu, ap1.datadoghq.com, ap2.datadoghq.com, uk1.datadoghq.com

{% callout %}
##### Preview

Bits Investigation in Error Tracking is in Preview.
{% /callout %}

{% /callout %}

## Overview{% #overview %}

[Bits Investigation](https://docs.datadoghq.com/bits_ai/bits_investigation.md) is an autonomous AI agent that investigates production issues. When you start an investigation from an Error Tracking issue, Bits analyzes the error, including its stack trace and related telemetry. If you set up [Source Code Integration](https://docs.datadoghq.com/source_code.md), Bits also analyzes your source code. It then reports the likely root cause and the impact of the issue.

To list all investigations triggered from Error Tracking, open [Investigations](https://app.datadoghq.com/bits-ai/investigations) and filter on Source: Error Tracking Issue.

## Prerequisites{% #prerequisites %}

- To view investigations, you need the [Bits Investigations Read permission](https://docs.datadoghq.com/account_management/rbac/permissions.md#bits-ai). To start investigations, you need the [Bits Investigations Write permission](https://docs.datadoghq.com/account_management/rbac/permissions.md#bits-ai).
- To let Bits read the code that was running when the error occurred, set up [Source Code Integration](https://docs.datadoghq.com/source_code.md). Bits can investigate without source code access, but the root cause analysis is less precise.
- To generate code fixes, set up [Bits Code](https://docs.datadoghq.com/bits_ai/bits_code/setup.md), which needs write access to your repository and the [Bits Code Write permission](https://docs.datadoghq.com/account_management/rbac/permissions.md#bits-ai).

## Investigate an Error Tracking issue{% #investigate-an-error-tracking-issue %}

To investigate an Error Tracking issue with Bits Investigation:

1. In the [Error Tracking Explorer](https://app.datadoghq.com/error-tracking), click an issue to open the issue panel.

1. On the Review tab, click Investigate this issue in the Bits Investigation banner.

   {% image
      source="https://docs.dd-static.net/images/error_tracking/bits_investigation/start_investigation.7449d689ec86fb69d45da7d4c5345ac8.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/error_tracking/bits_investigation/start_investigation.7449d689ec86fb69d45da7d4c5345ac8.png?auto=format&fit=max&w=850&dpr=2 2x"
      alt="The Bits Investigation banner on the Review tab of an Error Tracking issue, with the Investigate this issue button." /%}

While the investigation runs, the banner shows its progress and who triggered it. An investigation usually takes a few minutes.

1. When the investigation completes, review the findings in the banner:

   - **Root cause**: The most likely cause of the error, based on the evidence Bits gathered.
   - **Impact**: How the error affects your users and services.

For a completed investigation, the banner displays the root cause and impact side by side:

   {% image
      source="https://docs.dd-static.net/images/error_tracking/bits_investigation/investigation_summary.cfeb16f2e17991118bf65244a9f70eb3.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/error_tracking/bits_investigation/investigation_summary.cfeb16f2e17991118bf65244a9f70eb3.png?auto=format&fit=max&w=850&dpr=2 2x"
      alt="The Review tab of an Error Tracking issue, showing the root cause and impact found by Bits Investigation." /%}

If the available data is insufficient to support a conclusion, Bits marks the investigation as inconclusive.

1. (Optional) To see the full investigation, click View Investigation in the banner.

The investigation page shows the conclusion, suggested next steps, and a timeline of the evidence:

   {% image
      source="https://docs.dd-static.net/images/error_tracking/bits_investigation/investigation_report.c45653ecee0c4b3c1264787ae2bc943e.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/error_tracking/bits_investigation/investigation_report.c45653ecee0c4b3c1264787ae2bc943e.png?auto=format&fit=max&w=850&dpr=2 2x"
      alt="The Bits Investigation page for an Error Tracking issue, showing the conclusion, root cause, impact, a suggested next step, and the timeline." /%}

To ask follow-up questions about the investigation, use Bits Chat. For more information, see [Chat with Bits Investigation](https://docs.datadoghq.com/bits_ai/bits_investigation/chat_bits_investigation.md).

For more information about how Bits reaches its conclusion and how to explore the investigation steps, see [How Bits investigates](https://docs.datadoghq.com/bits_ai/bits_investigation/investigate_issues.md#how-bits-investigates) in Investigate Issues.

## Fix the issue in code{% #fix-the-issue-in-code %}

When the root cause is in your code, Bits Investigation uses [Bits Code](https://docs.datadoghq.com/bits_ai/bits_code.md) to generate a fix. The fix appears as a suggested next step on the investigation page, with a summary of the change and its diff.

A code fix next step includes actions to open a pull request or keep working on the fix:

{% image
   source="https://docs.dd-static.net/images/error_tracking/bits_investigation/code_fix_next_step.15e76eedd708a4355eac6ee1b5b34178.png?auto=format&fit=max&w=850 1x, https://docs.dd-static.net/images/error_tracking/bits_investigation/code_fix_next_step.15e76eedd708a4355eac6ee1b5b34178.png?auto=format&fit=max&w=850&dpr=2 2x"
   alt="A suggested next step with a code fix generated by Bits Code, showing a summary, a diff, and the Create PR and View in Bits Code buttons." /%}

From the next step, you can:

- Click Create PR to open a pull request with the fix.
- Click View Full Diff to review all changed files.
- Click View in Bits Code to iterate on the fix in a Bits Code session.

Bits Code never merges changes automatically. Review and test generated code before you merge it.

## Further reading{% #further-reading %}

Additional helpful documentation, links, and articles:

- [Learn about Bits Investigation](https://docs.datadoghq.com/bits_ai/bits_investigation.md)
- [Chat with Bits Investigation](https://docs.datadoghq.com/bits_ai/bits_investigation/chat_bits_investigation.md)
- [Generate code fixes with Bits Code](https://docs.datadoghq.com/bits_ai/bits_code.md)
- [Set up Source Code Integration](https://docs.datadoghq.com/source_code.md)
