# AI Bug Fix

Inspector can automatically generates code change proposals to fix application errors detected in real-time. You will receive the first bug fix solution without having to ask your collaborators for time, or wait to be in front of the desk to analyze the problem manually.

To enable AI Bug Fixer you should connect your Inspector account with the source control providers where you host your source code.

### Connect to source control providers

Navigate to the [**Source Control**](https://app.inspector.dev/organization/vcs) section in the Organization menu.

<figure><img src="/files/zbWqAOqjvUvHhFvNBEzb" alt=""><figcaption></figcaption></figure>

Click on the connect button to follow the installation process. Make sure to grant the Inspector app access to the repositories you want to connect to. You will be redirected to this page.

### Configure the AI Bug Fixer

Once you enabled the connection with the source control provider, you should associate a specific repository to the application you want to enable the AI Bug Fix.

Go into the ***Application Settings -> AI Bug Fixer*** section.

<figure><img src="/files/519Gug1LBlR9mQS9ACBx" alt=""><figcaption></figcaption></figure>

Here are the configurations you need:

* The **repository** to connect from the source control provider;
* The default **branch** you want Inspector to connect to;
* The **root path** of the application on your production server;

#### How to find the root path on the server

SSH into your server and go to the directory where your application is located:

```sh
> cd app-directory/
```

Execute the [pwd](https://en.wikipedia.org/wiki/Pwd) command to see the full root path on the server:

```
> pwd
```

Paste the output into the input field in the configuration form.

Click **Save** to activate the integration.

### Zero Downtime Deployment

If you use zero downtime deployment as release strategy, the real path of the application on your server will change on any deploy. As you know zero downtime deployment will create a new directory on every release.

In this case you need to use the wildcard character "\*" to map the release directory. See the example below:

```bash
# The final directory will change on every release
/var/www/html/public_html/releases/382758329/

# This is how you should configure the root server path on Inspector
/var/www/html/public_html/releases/*/
```

### Receive Bug Fix Proposals

Once an error is detected, Inspector will use the gathered information to generate a solution starting from your original source code that may fix the error immediately.

If Inspector successfully generates a bug fix, you will see the "source code" icon in the errors list colored in orange.

<figure><img src="/files/NFI19xPFOTj2ccmMiMYl" alt=""><figcaption><p>Inspector Errors List</p></figcaption></figure>

And you will be able to read the entire fix proposal automatically created for you.

<figure><img src="/files/DNwVjASQYm768pu3jkuY" alt=""><figcaption><p>Inspector Ai Bug Fix</p></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.inspector.dev/concepts/ai-bug-fix.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
