# Troubleshooting

Fixes for common problems with the preview, the sandbox, build errors, sign-in, the database and publishing.

Your project runs in its own cloud machine, with a development server for a React app written in TypeScript and Tailwind CSS. Most problems show up in the preview, the terminal or the console. Start with the section that matches what you see.

## The preview does not load

### The preview is blank or shows Preview disconnected

When the sandbox stops responding, the canvas shows **Preview disconnected** and Lyna restarts it for you. Choose **Retry now** to try again at once. If the preview still does not come back, choose **Restart sandbox** in the bottom bar. Your files are kept.

### Cloud machines are unavailable right now

While the project opens, the loader can say **Cloud machines are unavailable right now**: for a while, Lyna cannot start a cloud machine for any project. Your project and files are safe, and nothing is lost. Choose **Try again** in a few minutes: the message stays on screen while Lyna asks, and the project opens as soon as a machine starts. **System status** shows how the service is doing.

### Your project is paused

Your project pauses when you leave it, to save resources. When you come back, the canvas shows **Your project is paused**: choose **Resume**. Your work is saved.

### Your project stopped running

The project's machine was shut down from outside, for example during maintenance. Choose **Reconnect** to start it again, or **Save and leave**.

### Project taken over

You opened the same project on another device. Choose **Continue here** to take the project back on this device, or **Back to projects**.

### The terminal shows an error

Open the terminal with `Cmd/Ctrl + J`. Common causes:

- **A missing package**: the code imports a package that is not installed. Ask the AI to install it.
- **A syntax error**: a broken file stops the dev server. The error names the file and line.

## Build and code errors

### The preview shows an error

Read the file name, line and message. Fix the first error first: later errors often come from it. Common causes are an import of something that does not exist, a type mismatch, or a missing bracket or closing tag.

### Ask the AI to fix it

In the [devtools](/features/test-and-debug/devtools) console, choose **Ask the agent to fix this** on an error. Or type `/fix` in the chat, or add the current errors with `@` and **Problems**. See [Mentions and context](/features/ai/mentions-and-context).

### A change broke the app

Revert to the version before the change from its version card in the chat, or from [Version history](/features/projects/version-history). This is faster and safer than many follow-up fixes.

### A page shows Not found

Each page needs a route in the app's router. Ask the AI to add the route, or check [Pages and routes](/features/design/pages-and-routes).

## Sign-in problems

### Sign-in works in the preview but not on the published site

Add your published address, and your custom domain, to the **Site URL** and **Allowed redirect URLs** in [Users and auth](/features/cloud/users-and-auth#advanced).

### Confirmation emails do not arrive

Check the spam folder. In **Settings > Lyna Cloud > Users**, check the **Email** sign-in method under **Sign-in methods**, and the **Confirm signup** template under **Emails**.

### Users are signed out on refresh

Ask the AI to check how the app creates its database client and stores the session. There must be one client for the whole app.

## Database problems

### Queries return no rows, but the table has data

Row level security is on and no policy allows the read. Open **Audit** in [Database](/features/cloud/database#audit), or the table's **Policies** tab, then add a policy or ask the AI to add one.

### A migration fails

Common causes:

- A new required column on a table that already has rows. Give it a default value.
- A table that already exists.
- A link to a table that does not exist yet.

Open **Migrations** in [Database](/features/cloud/database) to read the error, then ask the AI to fix the migration.

### The app cannot reach the database

Check that [Lyna Cloud](/features/cloud/overview) is set up for the project. The app must use the **Publishable key** in the browser, never the **Secret key**.

## Publishing problems

### Publishing fails

Open [Deployments](/features/publish/deployments) and read the build log of the failed deployment. Ask the AI to fix the error, then publish again.

### My custom domain does not work

Check the records in **Configure DNS** at your registrar, then choose **Check DNS**. DNS can take up to 48 hours. See [Custom domains](/features/publish/custom-domains).

## General tips

- **Read the error first.** The terminal and the console usually say what is wrong.
- **One fix at a time.** Check the result before the next change.
- **Ask before you change.** Switch to **Ask** mode and describe the problem: the AI reads your code and explains without editing. See [Chat modes](/features/ai/chat-modes).

> [!NOTE]
>
> **Still stuck?**
>
> Go back to the last version that worked, then ask again with a clearer prompt. See [Best practices](/tips-and-tricks/best-practices).

## Related

- [Debugging with the AI](/prompting/debugging): Send errors to the AI and fix them fast.
- [DevTools](/features/test-and-debug/devtools): Console, network and more.
- [Support](/introduction/support): Get help and report a bug.
