> ## Documentation Index
> Fetch the complete documentation index at: https://docs.validio.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Debugging an Incident

> Use the Debug feature in Validio to generate sample SQL and investigate the data causing quality incidents.

When investigating individual [incident groups](https://docs.validio.io/v10.0/docs/incidents-and-errors/incidents/incident-details.md), the **Debug** feature generates sample SQL queries from captured incidents, allowing you to investigate the exact data causing quality issues directly in your database. For AI-assisted investigation, see [Root Cause Analysis](https://docs.validio.io/v10.0/docs/incidents-and-errors/root-cause-analysis.md).

![The debug information panel for a data warehouse source, showing the generated query and its results](https://mintcdn.com/validio/h4NQPs1kJwlpB1Yj/images/docs/incidents-and-errors/450-debug-information.png?fit=max\&auto=format\&n=h4NQPs1kJwlpB1Yj\&q=85\&s=5fa7f84a1dd898edb307caa5dd485275)

Debug Information for a Data Warehouse Source

## Prerequisites for debug

To use the Debug feature, ensure the following requirements are met:

* **Source type**: Debug is available for data warehouse and query engine sources where Validio uses SQL pushdown for validation.
* **Permissions**: Your role must have the following permissions in the namespace: `sqlExecution:WRITE` and `incidents:WRITE`. See [Managing Roles](https://docs.validio.io/v10.0/docs/access-and-settings/settings/managing-roles.md).

## How debug works

The **Debug** feature is available where individual incidents are listed, such as in a details page for incident groups, and provides:

* **Automatically generated SQL**: Validio generates an executable SQL query that reproduces the data quality incidents. The query,
  * Filters data down to the specific Window and Segment where the incident occurred.
  * Orders records based on how far away they are from being allowed, returning the most prominent outliers at the top.

> [!NOTE]
>
> **Troubleshooting Outliers**
>
> Although outliers are not the only cause of incidents, they are a good starting point for troubleshooting.

* **Sample data generation**: Use **Load samples** for Validio to automatically generate sample rows from the detected incidents to help you troubleshoot.
* **Query customization**: Modify the generated queries to explore different aspects of the problem. If needed, **Reset query** to remove your edits and return to the original generated SQL.
* **Copy support**: Copy the query to run in your preferred database tools for deeper analysis.
