# Debugging

## Tips on debugging errors with AI

Debugging with AI to fix errors is one of the most important skills in using Dyad — or any other AI coding tool — effectively.

If you haven't yet, I recommend reading the [Chatting guide](/content/docs/guides/chatting/index.html) for tips on chatting with AI effectively.

## [Prompting Tips](/content/docs/guides/debugging#prompting-tips/index.html)

### [Describe the issue clearly](/content/docs/guides/debugging#describe-the-issue-clearly/index.html)

Imagine you're talking to a human co-worker. If you said there's a bug, you'd try to provide as many details as possible so they know what you're referring to. The same principle applies when you're working with AI.

**Bad prompt: (unclear what to fix)**

> fix broken app

**Good prompt: (clear about what the issue is)**

> After I click the sign-up button, the page is blank.

The problem with the bad prompt is that it's so vague that:

- Dyad needs to guess which button you want fixed
- Dyad needs to guess what the issue is

Sometimes, even with an under-specified prompt, it will work — but often, it doesn’t.

### [Include detailed error messages](/content/docs/guides/debugging#include-detailed-error-messages/index.html)

Similar to the tip above, include error messages with as much detail as possible.

If you see an error in the UI, copy and paste the error message and ask the AI to fix it. For many errors, you'll see a **Fix with AI** button, but in some cases, you'll need to manually copy and paste them.

### [What to do when there are no error messages](/content/docs/guides/debugging#what-to-do-when-there-are-no-error-messages/index.html)

What if the app is broken but you don't see any error messages? You can still ask the AI:

> I don't see anything after I log in.

Sometimes this alone will fix the issue.

You can also ask the AI to add error handling and display error messages in the UI.

**Example**

Let’s say you’re getting a vague error after clicking the Sign-in button. You can ask Dyad:

> Add error handling when signing in and show detailed error messages in a toast.

Then, you can use the specific error message and have Dyad fix it.

## [Workflow Tips](/content/docs/guides/debugging#workflow-tips/index.html)

### [Test often & use undo](/content/docs/guides/debugging#test-often--use-undo/index.html)

One challenge with AI is that it can make unexpected changes, so I recommend regularly testing your app's main flows in the [preview panel](/content/docs/guides/previewing/index.html) to make sure nothing is broken (e.g., every few prompts). If something is off, use the undo feature, explained in the [versioning](/content/docs/guides/versioning/index.html) guide.

### [Try another model](/content/docs/guides/debugging#try-another-model/index.html)

Often, trying the same prompt with a different model — especially a more powerful one like Gemini Pro 2.5 or Claude Sonnet 4 — can get you much better results.

First, [undo](/content/docs/guides/versioning#how-to-undo/index.html), then click the **Retry** button.

### [Manage your context](/content/docs/guides/debugging#manage-your-context/index.html)

With Dyad, you can create [multiple chats](/content/docs/guides/chatting#use-multiple-chats/index.html) for the same app. If you run into an error saying you've hit your context window limit, start a new chat.

When you're getting close to the limit, Dyad will suggest **Summarize into new chat** above the chat input. Click that to start a new chat based on a summary of the current one — it’s a great way to clean up your context without starting from scratch.

## [Debugging Case Study](/content/docs/guides/debugging#debugging-case-study/index.html)

To see a real-world example of debugging an app in Dyad, watch this video where I integrate Supabase into an app and fix several errors along the way:

[Dyad: Supabase Integration & real-world debugging - YouTube](https://www.youtube.com/watch?v=Ew_mtiFpDg4)
