Errors

Every API and MCP error has a stable code, a message, usually a hint that says what to do next, and a docs_url pointing here.

bad_request · Bad request

The request is malformed or one of its values isn't valid. The message names the field and what's wrong with it.

What to do: Fix the input as the message and hint describe, then send the request again. Sending it unchanged fails the same way.

unauthorized · Unauthorized

The request has no usable credentials: the API key or temporary site token is missing, malformed or revoked, or its site was claimed or deleted. Over MCP, also a tool that needs the human's account (whoami, list_sites) called without credentials, or a sign-in token that expired, was revoked or was used outside the MCP server.

What to do: Send Authorization: Bearer <key> with a valid key. The hint says which case applies, for example to ask the human for an account API key, or to publish again without a token. Over MCP, an HTTP 401 carries a WWW-Authenticate challenge: an MCP client that supports OAuth signs the human in with it (or refreshes its token) and repeats the call.

forbidden · Forbidden

The credentials are valid but can't do this, for example a key scoped to one site acting on another, a route for operators only, or publish_site on an account whose human hasn't allowed agents to subscribe sites (or whose monthly number is used up).

What to do: Use a key that has access to the site. Account keys can act on every site in the account.

not_found · Not found

The site, file, deploy or link doesn't exist, or this key can't see it.

What to do: Check the id or slug (list_sites, list_files, list_deploys). A claim link is single-use: ask for a fresh one with claim_site.

conflict · Conflict

The request clashes with the current state, for example a slug that's taken, a change based on an outdated version, a custom domain that's on another site, or a site that already has one.

What to do: Read the current state again (get_site, list_files, list_domains), then retry with fresh values or a different slug. For a domain, the hint says how to free it or prove the human controls it.

payment_required · Payment required

This needs a paid site or plan: uploaded assets, custom domains, subsites (comped accounts only, for now), or more than three live trials in one account. Also publish_site when the human's saved card can't pay (none saved, declined, or their bank asks them to confirm it). Paid sites are $29 a month each (an introductory price, locked in), with one custom domain included.

What to do: Give the human the site's upgrade_url (from get_site). Until then, keep media in the site's own files, and the site at its bty.site address.

rate_limited · Rate limited

Too many of these requests in a short time, for example temporary sites from one network in an hour, deploys of one site in a day, screenshots of one site in an hour, or custom-domain adds, checks and removals of one account in 10 minutes. Also: the browser that takes screenshots is busy for a moment.

What to do: Wait and try again later, and batch changes into fewer requests. The hint says what the limit is.

limit_exceeded · Limit exceeded

A size or count limit was reached: a file, a request, an asset or the site is too large, or there are too many files. Also a contact-form message longer than 16 KiB (as stored) once the site's forms have stored the day's 32 MiB of messages.

What to do: Make the content smaller or split it up. Large media belongs in uploaded assets on paid sites (upload_asset). A visitor whose form message was too long today sends a shorter one, or tries again after midnight UTC.

invalid_path · Invalid path

A file path isn't allowed: it's empty, too long, has . or .. segments or control characters, ends with a slash, or uses a reserved prefix (_bty/, _assets/).

What to do: Use relative paths like "src/pages/index.astro", "src/content/blog/first-post.md" or "public/favicon.svg". Nothing goes under _bty/ or _assets/, in public/ either.

site_expired · Site expired

A temporary site (one hour) or a trial (7 days) ran out of time, or a paid site's subscription ended. Its pages show an expired or offline notice. A temporary site or a trial is deleted 7 days after it expires; a paid site whose subscription ended or is paused is archived for 6 months, then deleted.

What to do: Temporary site: get a claim link with claim_site and give it to the human. Trial, or a paid site whose subscription ended: give the human the site's upgrade_url (get_site) to subscribe ($29/month). A temporary site or trial can be brought back until it's deleted; an archived paid site, until its archive ends (get_site's kept_until); its files can be read meanwhile to keep a copy.

site_suspended · Site suspended

The site was taken down for violating the terms of service. It can still be read, but nothing can change, publish or delete it.

What to do: Tell the human. To appeal, they can email support@beautiful.site.

template_error · Template error

The site couldn't be built. Every new site is an Astro project, built on each deploy without npm install: a page, component or content entry has an error (a syntax error, a value that's undefined while rendering, an entry that doesn't match its collection's schema), or it uses something Beautiful doesn't provide (an npm package other than React, Preact and zod, an integration, fetch() at build time, on-demand rendering, Sass). The message is file:line: message for the first problem, followed by up to four more, and the hint says how to fix the first. A site without an Astro config or .astro files is built the older Eleventy/Liquid way, whose messages name the file and line too.

What to do: Fix what the message and hint describe, write the file again, and deploy. Nothing was published. What Astro features and packages Beautiful supports is in https://beautiful.site/llms.txt.

form_field_forbidden · Form field forbidden

A contact form or a submission to one has a password, card-number or one-time-code field (by its type, autocomplete or name, e.g. password, card_number, cvv, otp). Beautiful forms never collect them: a deploy doesn't register such a form (its checks.warnings say which field), and a submission with such a field is refused with nothing stored.

What to do: Remove the field from the form and publish again; checks.forms on the deploy lists the forms that were registered. Payments and sign-ins belong with services built for them, not in a contact form.

form_token_invalid · Form token invalid

A form submission's _bty_token is forged, older than 24 hours, for another form or site, was issued to another network, was used already, or was sent less than 2 seconds after it was issued. Nothing was stored. A submission without any token isn't refused: it's kept in the site's spam folder (held_for_review), and nobody is emailed.

What to do: Let /_bty/forms.js send the form (the build adds it to every page with a data-bty-form form): it takes a fresh token for each message, and fetches another and sends again once if this comes back. Custom JavaScript: POST /_bty/forms/{name}/token from the visitor's browser for each message, wait at least min_wait_ms, then send the form with the token as _bty_token; a token fetched by a server doesn't work from visitors' browsers. Visitors who see this reload the page and send the form again.

invalid_route · Invalid routing rule

A rule in the site's _redirects or _headers file, or one passed to set_routes, can't be used: a redirect without a status code, a header Beautiful sets itself, a proxy to something other than a public https site, or more rules than fit. The message names the file and line (or the rule's index); nothing was published.

What to do: Fix the rule as the hint says (for example add 301 to a redirect), then deploy or call set_routes again. get_routes shows the live rules.

migration_error · Migration failed

A file in the site's migrations/ folder couldn't be applied to the site's database (the message names the file and SQLite's error), or a migration the database has already applied was edited, which would leave the database out of step with the code. Nothing went live: the deploy stopped before the new code took traffic.

What to do: Fix the SQL and deploy again. Never edit an applied migration: add a new numbered file that changes the table instead (ALTER TABLE … ADD COLUMN). A migration only the preview database has applied can be edited after reset_preview_db, which empties the preview database and reapplies them. list_migrations shows what each database has applied.

plugin_error · Plugin error

A file in src/plugins/ or src/lib/ doesn't compile (the message names the file and line), imports something plugins can't use (only hono, zod, @beautiful/runtime and your own files there), a plugin's file name can't be its path under /api, or a page would be served under /api/, which belongs to plugins. Every problem in the build is listed. Nothing was published.

What to do: Fix each file as the message says and deploy again. A plugin is src/plugins/<name>.ts whose default export is a Hono app, mounted at /api/<name>/*; code plugins share goes in src/lib/. Move pages out of api/. Reach other services with fetch and a secret rather than a package.

outbound_refused · Outbound call refused

A site's own code called fetch() and Beautiful Sites didn't let the call out: a preview's plugins make no outbound calls (so a test never reaches a real person), a preview's proxies only read, and no site calls Beautiful's own domains, another site on Beautiful Sites, an IP address or a private network name. The plugin gets this as the response to its fetch, with status 403. Status 503 instead means the hostname couldn't be checked right then.

What to do: Test the outside service's part in production once the site is paid for, or behind a check that skips it in previews. Call outside APIs by their public hostname. Retry a 503.

sql_error · SQL error

SQL sent with query_db failed (the message has SQLite's error), or it would change the production database without write: true. Production is read-only by default so a query can't change visitors' data by accident.

What to do: Fix the statement, or check the table's columns with query_db and PRAGMA table_info(<table>). To change production data on purpose, ask the human first, then pass write: true; the change is audited. Change the schema with a new migration, not with query_db.

unavailable · Unavailable

A service we depend on didn't answer in time, for example myaccount while signing in to the dashboard, Stripe while paying for or deleting a site, Cloudflare while adding or removing a custom domain, or the browser that takes screenshots (or a page that didn't finish loading in time). Also: payments, custom domains or screenshots aren't set up yet on this server, or a site's contact forms have stored all Beautiful keeps for one site (8 GiB): they take nothing more until some of their messages are deleted.

What to do: Try again in a minute. Nothing was changed: a site whose subscription or custom domain couldn't be removed isn't deleted, and a domain Cloudflare didn't remove still serves the site, so repeat the request. For a site whose form storage is full (list_form_submissions says storage.full), ask the human what to delete, then call delete_form_submissions (the spam folder first, then older messages), or they delete them on the dashboard.

internal · Internal error

Something went wrong on our side. When the message says a change was saved but not fully applied, it finishes on its own within the hour.

What to do: Repeat the request. If it keeps failing, email support@beautiful.site with the request and the time.