# Debug Code Agent

The Debug Code feature analyzes your code on multiple test cases based on your approach and generates detailed fixes along with a description of the error that you may have otherwise missed to achieve the desired output.

Powered by internal AI agents, CodeMate's debug feature is a powerful tool that can help developers identify and fix errors in their code. It uses a combination of static analysis and machine learning to detect a wide range of errors, including:

* **Syntax errors**: Errors in the structure of the code, such as typos, missing commas, or mismatched parentheses.
* **Logical errors**: Errors in the logic of the code, such as incorrect conditional statements or loops.
* **Runtime errors**: Errors that occur when the code is executed, such as null pointer exceptions or out-of-bounds array accesses.
* **Compile-time errors**: Errors that are detected by the compiler, such as using an undeclared function or violating a type constraint.

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

In addition to detecting errors, CodeMate's code debug feature can also help developers to understand their code better.

It can provide explanations of how the code is executed, and it can show the values of variables at different points in the execution flow. This can be helpful for understanding complex algorithms and for tracking down the source of errors.

Once an error has been identified, CodeMate provides a detailed explanation of the error and suggests possible solutions. It can also automatically fix identified errors in a single click.

**Feature availability**: The Debug Code feature can be accessed within VS Code Extension, CodeMate CLI and CodeMate Web App.&#x20;


---

# 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.codemate.ai/c0/debug-code-agent.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.
