> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: About Errors in Studio Two

## Article: About Errors in Studio Two

## Article Link: https://dev.wix.com/docs/studio-two/test-your-site/about-errors-in-studio-two.md

## Article Content:

# About Errors in Studio Two

Errors in a Studio Two site's code show up in different places. The kind of error tells you whether the build failed, whether publishing can break the live site, and how to fix it.

## Where errors appear

| Error type | Where it appears | Stops the build? | Can break the live site? |
|---|---|---|---|
| [Code tab problems](#code-tab-problems) | Squiggles, the **Problems** panel, and the problem count in the status bar | Only some. See [the next table](#which-problems-in-the-code-tab-stop-the-build). | It can, when the problem also stops the build. See [Errors and publishing](#errors-and-publishing). |
| [Build errors](#build-errors) | The error indicator in the top bar, the **Site code errors** panel, and **Couldn't prepare site** in the status bar | Yes | It can. See [Errors and publishing](#errors-and-publishing). |
| [Runtime errors](#runtime-errors) | The browser console, when the code runs | No | No |

## Which problems in the Code tab stop the build

The first table groups errors by where they show up. Each row below is a Code tab problem. The third column shows which of those problems also become build errors, with **Couldn't prepare site** in the status bar and the error indicator in the top bar.

| Code tab problem | Example | Also a build error? | What else you see |
|---|---|---|---|
| Type error | `Type 'string' is not assignable to type 'number'` | No | The status bar stays **Synced**. |
| Syntax error | `';' expected.` | Yes | **Couldn't prepare site** in the status bar, and the error indicator in the top bar. |
| Missing module | `Cannot find module './file' or its corresponding type declarations.` | Yes | **Couldn't prepare site** in the status bar, and the error indicator in the top bar. |

## Code tab problems

A Code tab problem is a problem the **Code** tab reports as you type. Type errors, syntax errors, and missing modules are all examples of Code tab problems. A syntax error or a missing module also becomes a build error.

The **Code** tab reports them in three places:

- A red squiggle under the problem.
- A count on the file, on its parent folders, and in the status bar.
- The **Problems** panel. Each entry has a message, a TypeScript code, and a line and column. To open it, click the problem count in the status bar, or press `Control+Shift+M` (or `Command+Shift+M` on macOS).

A type error stays in the **Problems** panel and the site still builds. A syntax error or a missing module fails the build. To fix a Code tab problem, open it in the **Problems** panel and edit that line.

## Build errors

When you change your code, the editor saves it, syncs it, and prepares your site by building its extensions. The status bar at the bottom of the **Code** tab shows where this process is:

1. **Syncing changes…** The editor is saving your latest code.
2. **Preparing site…** The editor is building your site's extensions.
3. The process ends in one of these states:
   - **Synced.** Your changes are saved and your site is ready.
   - **Couldn't prepare site.** Your changes are saved, but the editor couldn't build the extensions, so your live site can't include them yet.
   - **Unsaved changes.** The editor couldn't save your latest changes.

A build error is the **Couldn't prepare site** state. When the build fails:

- The status bar shows a yellow **Couldn't prepare site**. Hover over it to see the message. After you fix the code, click it to try again.
- A red error indicator appears in the top bar, next to the **Design** and **Code** toggle. It appears on both the **Design** and **Code** tabs.
- Click the indicator to open the **Site code errors** panel. The panel lists each build error with its message, the file and line, and the code that caused it. For example, `[builtin:vite-transform] Unexpected token` or `[UNRESOLVED_IMPORT] Could not resolve './file'`.

The editor shows errors caused by your code in the top bar with the red indicator. If the build fails for another reason, such as a temporary issue on Wix's side, you can try again from the **Go live with your site** panel or by clicking **Couldn't prepare site** in the status bar.

To fix build errors, click **Go to code** in the **Site code errors** panel, edit the line, or click **Fix with AI**. See [Troubleshoot Build Errors](https://dev.wix.com/docs/studio-two/test-your-site/troubleshoot-build-errors.md).

Building usually takes under a minute. After you fix the code and a new build succeeds, the status bar changes to **Synced** and the red indicator turns into a green check that disappears after a few seconds.

To fix build errors, edit the line in the **Problems** panel, or click **Fix with AI**. See [Troubleshoot Build Errors](https://dev.wix.com/docs/studio-two/test-your-site/troubleshoot-build-errors.md). 

The **?** icon on the **Site code errors** panel opens [Troubleshoot Build Errors](https://dev.wix.com/docs/studio-two/test-your-site/troubleshoot-build-errors.md).

## Runtime errors

A runtime error happens when code that built successfully fails while it runs. The editor doesn't flag it as you type, because the code is valid until it runs.

For code that runs in the visitor's browser, such as an Editor React Component (ERC) click handler:

- The build stays successful. The error indicator and the **Site code errors** panel stay clear.
- The error appears in the browser's developer console when the code runs. For example, when a visitor clicks a button whose click handler throws.
- The page keeps working and shows no error message.

To fix a runtime error, edit the code that throws. The **Problems** panel stays clear, because the code built successfully.

Preview includes a **Developer Console** where you can review your site's logs while you test.

To read log messages from your site's code, open **Developer Tools > Logs** in the site dashboard. Your code writes these messages with the monitoring client, not with `console`, and uncaught backend errors appear there automatically. Code that runs in the browser writes log entries only on the live site, not in Preview. Uncaught errors in the browser appear only in the browser's developer console. See [About Logs in Studio Two](https://dev.wix.com/docs/studio-two/test-your-site/work-with-logs/about-logs-in-studio-two.md).

## Errors and publishing

Publishing with a build error can break the live site. While the build is failing, and before you publish, the live site still shows the last published version.

Fix build errors before you publish.

The editor still lets you publish. If you click **Publish** while the build is failing, the **Go live with your site** panel shows:

- **Code errors may impact your site.** A warning that the live site can break if you publish.
- **View in the error panel.** Opens the **Site code errors** panel.
- **Fix all with AI.** Asks Aria to fix the errors.

Click **Publish** on the panel to publish anyway. The panel then confirms **This site is published.**

<blockquote class="warning">

__Warning:__
Publishing a failed build can replace an ERC on the live site with **Element Didn't Load**. A syntax error in backend code, or in a function library the ERC doesn't use, can cause this. The rest of the page loads. After you fix the code and publish again, the component loads.

</blockquote>

A build error in a dashboard page won't necessarily prevent the site's components from appearing on the page. The dashboard page opens, and its content shows **Forbidden**. The editor still shows the build error and **Code errors may impact your site**.

## See also

- [Troubleshoot Build Errors](https://dev.wix.com/docs/studio-two/test-your-site/troubleshoot-build-errors.md): Find and fix build errors in your site's code
- [About the Development Environment](https://dev.wix.com/docs/studio-two/get-started/about-the-development-environment.md): How the **Code** tab works