> For the complete documentation index, see [llms.txt](https://gdplabs.gitbook.io/glchat/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gdplabs.gitbook.io/glchat/developer-documentation/debugging.md).

# Debugging

## Introduction

This document provides a structured approach for diagnosing and resolving issues in your GLChat application. It covers two primary types of problems: critical errors that cause the application to fail and accuracy issues that lead to suboptimal responses. Following this guide will help you efficiently troubleshoot and improve your chatbot's performance.

### Core Concepts: The State and the Pipeline

GLChat operates on a pipeline architecture. Every incoming request is encapsulated into a single Python dictionary known as the **state**. This `state` object contains all relevant information, such as the user's query, model, and configuration parameters.

The `state` is then passed sequentially through a series of processing **steps**. Each step can read data from, and write data to, the `state`. A deep understanding of this state-passing mechanism is fundamental to effective debugging, as most issues can be traced back to an incorrect or unexpected value within the `state` at a specific point in the pipeline.

### Common Debugging Scenarios

Most issues you'll face fall into two categories:

1. [**Functional Errors**](/glchat/developer-documentation/debugging/how-to-debug-errors.md)**:** Critical issues that stop the pipeline from completing, often resulting in a crash and a Python traceback in the logs.
2. [**Accuracy Issues**](/glchat/developer-documentation/debugging/how-to-debug-accuracy-issues.md)**:** More subtle problems where the application runs without error but the chatbot's responses are incorrect, irrelevant, or low-quality.

This guide is structured to address both scenarios in detail.
