> For the complete documentation index, see [llms.txt](https://docs.chatlayer.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chatlayer.ai/~/changes/zWOY8fNiBBrqneKkuGvA/tips-and-best-practices/solving-bot-issues.md).

# Solving bot issues

Whenever your bot does not behave the way you expect it to, you will need to investigate to see exactly what the issue is. This is also called debugging. But where to start with debugging? How can you find what the cause of an issue is? This article will go through the basics of debugging in the  Chatlayer platform. Make sure to check the subpages on the left side, where some common issues in the Chatlayer platform are described and how to solve them.

## Emulator

Debugging can be done very easily in the emulator, this is the `Test your bot` window in the right bottom corner. The emulator consists of three parts:

### Test your bot

The main part of the emulator shows the bot response on the left side, and typed input from the user on the right side:

![](https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LLTwFwbOqJj4dDhg8Ju%2F-MY9v4oOLPVGmc2mc8XU%2F-MY9wgVKNM1UY0v733iW%2Fimage.png?alt=media\&token=395b6945-6c47-4cce-986f-5728b8e3b6ee)

The following symbols are available for debugging:

<div align="left"><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LLTwFwbOqJj4dDhg8Ju%2F-MY9x6PI_rz6rPKIzdVq%2F-MY9zqrKCHMWVcOGh8yl%2Fimage.png?alt=media&amp;token=daf569bd-d6aa-4e0c-b4d1-1e5b70112d15" alt="Open the specific bot dialog that gives that rep"></div>

<div align="left"><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LLTwFwbOqJj4dDhg8Ju%2F-MY9x6PI_rz6rPKIzdVq%2F-MYA-6VTNmnYndpa7z8U%2Fimage.png?alt=media&amp;token=03c9ec57-4d89-4dbe-9676-9450290520e8" alt="Repeat that particular bot dialog or user input"></div>

<div align="left"><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LLTwFwbOqJj4dDhg8Ju%2F-MY9x6PI_rz6rPKIzdVq%2F-MYA-Yj2dn0yiWSrAGPw%2Fimage.png?alt=media&amp;token=ebb43e53-e103-4730-9ebc-5194b824133b" alt="Add that user input as an expression"></div>

Next to that, you can find the following options in this window:

<div align="left"><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LLTwFwbOqJj4dDhg8Ju%2F-MY9v4oOLPVGmc2mc8XU%2F-MY9wkCXAezAb3p7eLZb%2Fimage.png?alt=media&amp;token=1378fc27-a38d-47b8-9419-0e10930f6f7d" alt="Open the Debugger tab"></div>

<div align="left"><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LLTwFwbOqJj4dDhg8Ju%2F-MY9v4oOLPVGmc2mc8XU%2F-MY9wmw3s_UfjoLxGr0j%2Fimage.png?alt=media&amp;token=8b4a5e8e-d0e4-46a3-a074-d0606f94abed" alt="Open the NLP Result tab"></div>

<div align="left"><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LLTwFwbOqJj4dDhg8Ju%2F-MY9v4oOLPVGmc2mc8XU%2F-MY9wtBz3-RaR5eWXdC9%2Fimage.png?alt=media&amp;token=17557163-1794-4181-997a-62cbc172ee02" alt="Clear the entire conversation history and saved variables and start from scratch"></div>

<div align="left"><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LLTwFwbOqJj4dDhg8Ju%2F-MY9x6PI_rz6rPKIzdVq%2F-MY9xHQIL8Tzjvxr68Ha%2Fimage.png?alt=media&amp;token=fcedc757-62fd-40c4-9926-1d6b12446e93" alt="Choose the type of debugger window. Recommended is Debugger for the most information "></div>

<div align="left"><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LLTwFwbOqJj4dDhg8Ju%2F-MY9x6PI_rz6rPKIzdVq%2F-MY9xTw71tSKXjmM6u_y%2Fimage.png?alt=media&amp;token=02a0a0ce-01d8-4826-b1f0-b74104d38877" alt="Choose the language for this session in the emulator "></div>

### Debugger tab

In the debugger you can find the following information:

![](https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LLTwFwbOqJj4dDhg8Ju%2F-MY9x6PI_rz6rPKIzdVq%2F-MY9xsDRI_5QBgbH1O7G%2Fimage.png?alt=media\&token=9ce00129-a066-4d31-b3e0-4cfe44658ac3)

`User says` the input the user has given

`Intent` the recognized intent

`Contexts` if any [contexts ](https://docs.chatlayer.ai/understanding-users/using-context)are active and what the lifespan is

`Bot dialog` with the id and name of the current dialog

`Read-Only Session data` This is all data that is retrieved up until this point in the session. If you need to use any of these variables, it is important that you add `internal.` before the variable. For example `internal.channel`

If there are any variables collected in the conversation along the way, they will be listed at the bottom. If you want to use these, `internal.` is not necessary

<div align="left"><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LLTwFwbOqJj4dDhg8Ju%2F-MY9x6PI_rz6rPKIzdVq%2F-MY9ywRSXVLtwVbkLdOf%2Fimage.png?alt=media&amp;token=6ae908cf-ec84-454a-8f2e-27b0636e0226" alt=""></div>

If you need to use any of the variables with a `{ }` behind it, remember to use the correct variable name when you open the variable. For example `internal.currentDialogstate.name`

Below `Messages` (on the right side) you can see all the messages the bot has given up until that point.

### NLP Result tab

The NLP Result tab shows the result of the NLP engine. Any recognized intents or entities are shown here

![This expression gives a 93.86% positive score for the Book train ticket intent ](https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LLTwFwbOqJj4dDhg8Ju%2F-MYA-e3q8cidWrvKy--T%2F-MYA-wA8MM4HK8VW6yeE%2Fimage.png?alt=media\&token=d5feec27-2f7c-46d0-9e9e-053b25601759)

This information helps locating intent issues - if a wrong response is given in the bot, you can check here which intent was triggered.

![The word 'fries' gives a 100% match with the value 'fries' of the 'food' entity ](https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LLTwFwbOqJj4dDhg8Ju%2F-MYA0YSuBWkOP4ua5g9w%2F-MYAEzZkKEzgaOcpVuLT%2Fimage.png?alt=media\&token=c973362b-b30d-4f92-a75f-a8821817754b)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.chatlayer.ai/~/changes/zWOY8fNiBBrqneKkuGvA/tips-and-best-practices/solving-bot-issues.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
