# Troubleshooting

## It doesn't show

1. **Not published.** `list_components` says `hidden_until_publish`: a from-scratch
   component's live file is empty until its first `publish`. Previews still show the draft.
2. **Not on a page yet.** `pages` is empty or `preview_url` is `null`: no normal visit has
   loaded the snippet. Open the page (that reports it), then `next_step` with `page_url`.
3. **Snippet not on the page.** Search the page's HTML for `data-seamble-id="k7mq"` and
   `/c/k7mq.js`. Missing: the Code Block or the page wasn't saved, or it's another page. Shown
   as text: it's in a Text block, or the Code Block is in CSS, JavaScript or Plain Text mode, or
   has Display Source on. Changed: compare with `get_code`.
4. **Scripts don't run.** JavaScript in Code Blocks needs a Core, Plus, Advanced, Business or
   Commerce plan. Trial sites don't run it.
5. **Private site.** A password-protected or private site shows a lock screen to a logged-out
   browser, so the page never reports and `preview_url` opens the lock screen. The owner has to
   view it signed in.
6. **Signed in to Squarespace.** Code Block scripts may not run while the owner is logged in
   and editing; see [Squarespace](squarespace.md#the-editor).
7. **Console errors.** Look for `[seamble k7mq]` and each mount's `data-sb-state` (`error`
   means `init` threw).
8. **`SyntaxError` in `c/k7mq.js`.** The live code doesn't parse. Fix it and check it parses
   (`update_component` returns no `module-syntax` warning). Previews can't load until the fix
   is live, so ask the owner to let you publish it.
9. **Stuck in preview.** A preview link leaves a `seamble_preview` cookie for an hour: that
   browser shows drafts, and nothing once the link expires. Open the page with
   `?seamble_preview=off`.

## It doesn't change

- **Preview:** open the new `preview_url`. Leaving out `css` keeps the previous CSS.
- **Live:** only `publish` changes it, on the next page load. Open pages keep the old code
  until reloaded.
- **Check the file:** fetch `https://cdn.seamble.com/c/k7mq.js` (or `.css`). Change there:
  reload the page. Not there: it wasn't published.

## It differs between preview and live

Put all the code inside the starter's IIFE ([Runtime](runtime.md#why-the-starter-looks-like-this)).

## On seamble.com

The component page runs the published file in a mount with `data-demo`, with no Squarespace
page around it: no sections, no blog, no Squarespace variables. Before the first publish it
shows "Your AI shows you a preview on your page before it goes live." instead. A component
that needs the page should render sample content when `el.dataset.demo !== undefined`.

## Tool errors

`no_plan`, `component_limit`, `load_limit`: the result's `next` says what to tell the owner.
`No component … in your workspaces`: wrong id, or another org (`list_orgs`, `switch_org`).
