# Debugging Failed Runs

When running dbt™ in production, it's crucial to quickly identify and resolve failed runs. This guide will walk you through the process of debugging failed dbt™ runs using Bolt's comprehensive logging and debugging tools.

**Estimated completion time:** 15 minutes

{% hint style="warning" %}

#### Prerequisites

* Access to the [Bolt application](https://www.paradime.io/pricing) in Paradime
* At least one configured Bolt schedule
* Basic understanding of dbt™ commands and SQL
  {% endhint %}

{% hint style="info" %}

#### What you'll learn

In this guide, you'll learn how to:

1. [Identify failed runs](#id-1.-identifying-failed-runs)
2. [Access and interpret run logs](#id-2.-access-and-interpret-run-logs)
3. [Debug and resolve common issues](#id-3.-debug-and-resolve-common-issues)
   {% endhint %}

{% embed url="<https://youtu.be/yJ1z2m-fRAw>" %}

***

### 1. Identifying Failed Runs

There are two main ways to identify failed runs:

**Method 1: Notifications**

Set up [Slack or email notifications](https://docs.paradime.io/app-help/guides/paradime-101/running-dbt-in-production-with-bolt/setting-up-notifications) to receive immediate alerts when a run fails. This is the recommended approach for production environments.

{% hint style="info" %}
See [Setting Up Notifications](https://docs.paradime.io/app-help/guides/paradime-101/running-dbt-in-production-with-bolt/setting-up-notifications) for details on configuring alerts.
{% endhint %}

**Method 2: Bolt UI**

Navigate to the [Bolt home screen](https://app.paradime.io/bolt/) and check the "Status" column in the Bolt Schedule List. Failed runs are marked with a "Error" status indicator.

{% hint style="info" %}
See [Viewing Run History and Analytics](https://docs.paradime.io/app-help/guides/paradime-101/running-dbt-in-production-with-bolt/viewing-run-history-and-analytics) for more details on using the Bolt UI.
{% endhint %}

***

### 2. Access and interpret run logs

Once you've identified a failed run, access the logs through the Bolt Schedule Detail Views:

1. Click on the failed Bolt Schedule (one marked with a "Error" status indicator)
2. Navigate to the **Run History** section
3. Select the failed run (one marked with a "Error" status indicator)
4. Scroll to the **Logs and Artifacts** section
5. Click on the executed command that failed (ex. `dbt run`)

Bolt Provides three types of logs:

| Run Log Type     | Description                                                                                                                                                                                  | Use Case                                 |
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- |
| **Summary Logs** | [DinoAI-generated](https://docs.paradime.io/app-help/guides/paradime-101/getting-started-with-the-paradime-ide/dinoai-accelerating-your-analytics-engineering-workflow) overview of failures | Quick assessment of issues               |
| **Console Logs** | Detailed execution record                                                                                                                                                                    | Finding specific errors and compiled SQL |
| **Debug Logs**   | System-level operations                                                                                                                                                                      | Deep technical troubleshooting           |

{% hint style="info" %}
**Console logs** are typically the most useful for debugging as they show errors, warnings, and the compiled SQL code that failed in production.
{% endhint %}

***

### 3. Debug and resolve common issues

Follow these steps to debug a failed run:

1. **Review Summary Logs**
   * Check the AI-generated overview
   * Note any suggested fixes

{% code title="Summary Logs Example" %}

```
Command executed 6 models:
- 5 models passed
- 1 model failed
- Error in "fct_fantasy_point_leaders" model
- Invalid identifier 'TOTAL_FANTASY_POINTS_PP' on line 9
```

{% endcode %}

2. **Review Console Logs**
   * Locate error messages and warnings using the "jump to" feature
   * Click on the link for compiled SQL code
   * Review the execution flow and timing

<figure><img src="https://2337193041-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHET0AD04uHMgdeLAjptq%2Fuploads%2FNudj458VMNOUcZwf0ZKf%2Fimage.png?alt=media&#x26;token=f0877858-a6ea-46f7-ab81-7dd24b998b2a" alt=""><figcaption></figcaption></figure>

3. **Test and Fix**
   * Copy the compiled SQL code from console logs
     * Test the SQL:
       * Directly in your data warehouse, or
       * In the Code IDE [scratchpad](https://docs.paradime.io/app-help/documentation/code-ide/additional-features/scratchpad)
     * Fix common issues:
       * Invalid column names
       * Missing model references
       * SQL syntax errors
       * Data type mismatches

<figure><img src="https://2337193041-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHET0AD04uHMgdeLAjptq%2Fuploads%2FdNXIxczZ4eQXcnpPEnFi%2Fimage.png?alt=media&#x26;token=c2762426-d96a-44ba-af79-08a1e89eaddc" alt=""><figcaption></figcaption></figure>

After testing the compiled SQL code against your data warehouse, you'll be better equipped to resolve common issues with failed scheduled runs.

***

{% hint style="info" %}

#### Related Documentation

* [Setting Up Notifications](https://docs.paradime.io/app-help/documentation/bolt/creating-schedules/notification-settings)
* [Viewing Run History and Analytics](https://docs.paradime.io/app-help/documentation/bolt/managing-schedules/viewing-run-log-history)
  {% endhint %}

***

#### Summary

You've learned how to identify failed dbt™ runs, access and interpret different types of logs, and systematically debug and resolve issues. This knowledge will help you maintain reliable data pipelines and quickly resolve any failures that occur.

Next, consider exploring the related documentation to handle more complex failure scenarios.


---

# 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.paradime.io/app-help/guides/paradime-101/running-dbt-in-production-with-bolt/debugging-failed-runs.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.
