Reference
Constraints
Every rule an ogygia app follows, grouped by task. Each one says what you get when you break it (a build error, a server error, a browser error or a warning), with its message code, and how to fix it.
On this page
This page lists the rules in one place, so you can look one up when a message names it or before you try something new. Each rule links to the page that explains it.
Every message ogygia prints starts with [ogygia] and ends with a link to its code’s page, https://ogygiajs.dev/e/<code>, which says what went wrong and what to do. In a production build the browser prints only the link, to keep the wording out of your bundle. The If you break it column says where you’ll meet each one:
| Kind | Where you see it |
|---|---|
| build error | vite build or the dev server stops, naming the file and line. |
| build warning | Printed during the build or in the dev server’s terminal. The build goes on. |
| server error | Thrown while a request renders, so the page or the hole’s request fails. |
| server warning | Logged by the server. The response still goes out. |
| browser error | Thrown or logged in the browser console. The region usually keeps its server HTML. |
| browser warning | Logged in the browser console, in dev and production. The page keeps working. |
| dev warning | Logged in the browser or the terminal by the dev server only. A production build is quiet. |
Where a message can come from either side, the row says so. A rule with no code says what you see instead. Some of those fail quietly, which is why they’re listed.
App setup
These are checked when Vite loads your config. Installation and Packages show the wiring they protect.
| Rule | If you break it | Fix |
|---|---|---|
ogygia() and every ogygia plugin come before sveltekit(). | build error, plugin_after_sveltekit | Reorder: [ogygia(), flags(), sveltekit()]. |
| A plugin is listed by calling its factory. | build error, plugin_factory_not_called | Write flags(), not flags. |
| Each plugin is listed once. | build error, plugin_listed_twice | Keep one entry, with all its options. |
A feature plugin is listed beside ogygia(). | build error, plugin_without_ogygia | Add ogygia() first. |
A plugin that needs another has it listed (postrender() needs dataShake()). | build error, plugin_needs_plugin | List the plugin the message names. |
| Plugin options are plain JSON. | build error, plugin_options_not_json, only for a value JSON.stringify throws on (a cycle, a BigInt); a function or class instance is dropped with nothing said (#2314, item 10) | Set up clients and functions in hooks.server.ts. |
ogygia() gets only the keys it has. | build error, option_unknown (for barrels, it names barrels()) | Check the key against the options. Features are plugins now. |
A preset sets render or wake, and only preset keys. | build error. An empty preset or an unknown key fails when the config loads, preset_empty, preset_key_unknown. A preset with neither fails where an import uses it, region_import_invalid. | See presets. |
maxPageAge is a number of seconds. | build error, max_page_age_invalid | maxPageAge: 30 * 24 * 3600. |
importKeys names are distinct JavaScript identifiers. | build error, import_key_invalid, import_keys_not_distinct | Rename them. |
A package with a build half has its plugin listed when you import it (@ogygia/flags). | build warning, plugin_not_listed | List its plugin beside ogygia(). |
optimizeDeps.include doesn’t list ogygia. | build warning, optimize_deps_includes_ogygia | Remove those entries. ogygia keeps itself out of pre-bundling. |
hooks.server.ts exports ogygia.handle(), alone or inside sequence(). | browser warning, region_fetch_failed: the endpoint answers Kit’s 404, and the region keeps its fallback. | export const handle = ogygia.handle(). |
A region crossing the wire (from a remote function or a server load) has transport in src/hooks.ts. | Kit refuses to serialize the region. | export const transport = ogygia.transport (Add the transport hook). |
Import marks
The build reads marks from the source, so they have to be static and sit on a component you place. Regions explains why.
| Rule | If you break it | Fix |
|---|---|---|
Marks go on a static import, never on import(). | build error, dynamic_region_import | Gate a marked import with {#if}, or await import() a plain component inside an island. |
| Every name a marked import binds is used as a component. | build error, region_binding_not_component | Put helpers and differently scheduled components on their own import lines. |
No mark on import * as, import type or a bare import 'x'. | build error, region_import_namespace, region_import_type_only, region_import_bare | Import each component by name. |
A marked component isn’t placed as a dotted tag (<Menu.Item>). | build error, region_dotted_tag | Import and mark Item itself. |
A .svelte import takes only wake, fetch, render, preset, region, keep, prefetch and stitch. | build error, region_attribute_unknown | margin and maxAge go in a preset. |
In a .svelte file, wake is 'load', 'idle', 'visible', 'interaction', 'none' or a media query in parentheses. | build error, region_import_invalid | Fix the value. |
A server island is timed with fetch, never wake. | build error, hole_wake_removed | with { render: 'deferred', fetch: 'visible' }. |
fetch, prefetch and stitch need render: 'deferred'. keep needs a wake. preset and region stand alone. render: 'static' needs a wake. | build error, region_import_invalid | The message prints the line to write. |
region has one value, 'raw'. | build error, region_value_not_raw | Use wake for a schedule. |
A server island or held region gets no markup between its tags, except the ogygiaFallback snippet on a server island. | build error, region_children_not_portable | Pass data as props and put the markup inside the component. |
In a .ts or .js module, a marked import is one kind: region: 'raw', a wake, or render: 'deferred' with an optional fetch. Its wake can’t be 'none'. | build error, wake_strategy_unknown, held_marker_mixed, held_render_unknown, held_render_live, held_fetch_without_render, held_fetch_not_timing | Mark render: 'live' in a .svelte file. |
| A component imported from a package resolves from the file that marks it. | build error, island_import_unresolved | Install the package; its exports needs the subpath, with a svelte condition. |
import.meta.og.asRegion() is gone. | type error, and a TypeError where it runs | Mark a named import: import { Search } from 'x' with { wake: 'idle' }. |
| A component the build can’t parse keeps plain imports. | build warning, region_host_skipped | Fix the parse error Svelte reports. |
A dynamic import can’t carry marks, so gate a static one instead:
<script>
// ✗ a dynamic import with marks: Vite drops them, so the build refuses it
// const Chart = await import('$lib/Chart.svelte', { with: { wake: 'visible' } });
// ✓ a static marked import, placed behind an if block
import Chart from '$lib/Chart.svelte' with {
wake: 'visible'
};
let open = $state(false);
</script>
{#if open}<Chart />{/if}Props
Each island is its own root, so what you hand it is serialized into the page and rebuilt in the browser. Serialization has the full table of what crosses and how.
| Rule | If you break it | Fix |
|---|---|---|
| Props are data devalue can copy, a wired instance, or a store. | server error, prop_not_serializable | Pass plain data, give the class a wire codec, or move the logic inside. |
| Don’t pass a plain function as a prop. | The server can take it for a snippet and freeze what it returns, with no error (#2272). When it can’t freeze it: server error, function_prop_cannot_cross. | Mark it with import.meta.og.$, call a remote function, or keep the behavior in the island. |
import.meta.og.$ wraps one inline function, captures no server-only value, and isn’t nested. | build error, macro_dollar_misuse | See Pass a function. |
A value checked with import.meta.og.$(value) can cross. | browser or server error where it’s marked, boundary_refused | Change the value at the path the message names. |
| An island doesn’t write to its props. | dev warning, prop_mutation. Nothing outside changes. | Copy the prop into $state and change that. |
A snippet crossing into an island doesn’t read $$props or $$restProps. | build error, snippet_reads_dollar_props | Read what it needs into a host variable first. |
A $store read in a crossing snippet is a snapshot. | build warning, snippet_store_snapshot (snippet_store_unverified when the name isn’t declared in the host) | Read the value outside the snippet, or share a wired class. |
| A crossing snippet doesn’t use a store object declared in the host. | build warning, snippet_captures_store | Read it with $ in the snippet, or pass the store as a prop. |
A wire codec is static wire = import.meta.og.wire({ encode, decode }) on a named, exported class in a file the app compiles. | build error, macro_wire_misuse, wire_class_anonymous; server error, transportable_unregistered | See Wired classes. |
| An island that gets a wired instance can load its class. | browser error, transportable_class_missing | Import the class as a value in the island. |
Two wired classes don’t share a continuity id. | browser error, logged, continuity_id_collision | Give each class its own id. |
An og_derived formula is marked with import.meta.og.$. | browser error, og_derived_formula_missing | og_derived(src, import.meta.og.$((n) => n * 2)). |
| An island that gets a factory store imports the factory’s module. | browser warning, store_factory_missing. The store arrives as a plain writable. | Import the module in the island. |
| A store factory returns a store on every call, on the server and in the browser. | server or browser warning, store_factory_unbranded (it can’t be marked to cross); browser warning, store_factory_bad_rebuild (the island rebuilds a plain writable). | Put environment checks inside the factory, and return writable(seed) behind them. See Factory stores. |
| A store factory doesn’t freeze or seal the store it returns. | server or browser warning, store_not_extensible. It crosses as a plain writable. | Freeze it after the factory returns it, or leave it extensible. |
| Remote functions called from the browser get plain data, not regions, snippets, functions, stores or wired instances. | server error, 400, remote_arg_not_data | Send an id and build the value on the server. |
| Everything that crosses is public: it’s in the HTML. | No code. ogygia doesn’t filter props or context. | Read secrets on the server, in a remote function or a server island. |
Context
Svelte’s tree context doesn’t reach an island in the browser, because each island is its own root. ogygia carries context across through the page. Reach a subtree with context shows each form.
| Rule | If you break it | Fix |
|---|---|---|
Context an island reads is set with setContext, createContext or <Provide> from ogygia. | build warning, island_context_unprovided; browser warning, hydration_discarded, as the island throws its server HTML away | Change the import in the layout from svelte to ogygia. |
A context key is a string or Symbol.for('name'). | build warning, region_context_key_one_off; dev warning, context_key_one_off. Islands read undefined. | Use createContext('name'), a string, or Symbol.for. |
| A context value is data, a store or a wired instance. | dev warning, context_dropped, context_unserializable, context_value_function. Islands read undefined. | Pass data, or keep the key server-side with setContext(key, value, { islands: false }). |
A <Provide> value can be copied. | server error while rendering. A bare function freezes quietly as a snippet (#2272). | Pass data, a store or a wired instance. For a host-only value, use setContext(key, value, { islands: false }) instead of <Provide>. |
| Context written into the page stays under 32 kB. | dev warning, context_marker_large, naming the largest keys | Slim the values, or keep host-only keys with setContext(key, value, { islands: false }). |
A createContext getter runs below its setter. | browser or server error, context_missing | Set it in a layout, or ask has() first. |
| A server island doesn’t read the page’s context. | No code: it renders alone and sees no context. | Read context in a wake island nested inside it. |
| Read context during setup, not in an event handler. | Svelte throws, as anywhere. | Keep the reference from setup. |
csr = false pages
On a csr = false page Kit’s client never starts. The page and layout run only on the server, and the browser runs only your islands. Introduction explains the model.
| Rule | If you break it | Fix |
|---|---|---|
| Browser code goes in an island. | No code: onMount, $effect and listeners in a page or layout never run. | Move it into an island, or a boot island for code with no UI. |
An inline <script> in the markup runs once, on the first full load. | No code: SPA navigations don’t run it again. | Use an island, or og:page-load (see Run code on every navigation). |
script() gets one body (run, json, ld, importmap or speculation), a function for run, JSON data, imports only with type: 'module', and no import() inside run. | server error, script_one_kind, script_run_not_function, script_not_json, script_imports_need_module, script_import_not_url, script_run_rewritten, script_bad_attribute | See Pre-paint scripts. |
Islands navigate with goto from ogygia/app to an http(s) URL on your origin. | browser error, goto_not_http, goto_cross_origin | Pass { external: true } to leave the app; use a link for mailto:. |
Kit’s pushState, replaceState and disableScrollHandling do nothing under the router. | browser warning, shallow_routing_unsupported, scroll_handling_noop | Navigate with goto(), or keep the state in the URL. |
keep needs the router. | dev warning, keep_without_router | Remove router: false, or drop keep. |
A block-rooted island (<div>) isn’t placed inside a <p>. | dev warning, island_block_in_inline. The parser moves it out and it mounts twice. | Root it in a <span>, or put it on its own line. |
| Nothing edits an island’s HTML before it wakes, and nothing reshapes it after the render. | dev warning, island_healed; browser warning, hydration_discarded | Leave <ogygia-region> alone; use rewrite(), never transformPageChunk, for an HTML pass. |
| A third-party widget inside an island doesn’t add nodes Svelte hydrates. | dev warning, ownership_conflict | See DOM ownership. |
On a csr = true page an island is an ordinary component. | dev warning, island_on_kit_page. Its wake does nothing. | Put it inside a lake, or serve the route csr = false (Keep app-like routes on Kit). |
| An element the router or a region update brings in has no closed declarative shadow root. | dev warning, closed_shadow_root_lost. The copy has no shadow root, so what it painted is gone. | Use shadowrootmode="open", or let the component attach its own root. See Web components. |
| A promise a load streams settles. | dev warning, page_promise_pending, after 10 seconds. The response stays open until it settles. | Give the work behind it a timeout of its own. See Stream a slow value. |
A preference() default is one of its values. | server or browser error where preference() is called, preference_default_invalid | Pick a default from values. See preference(). |
A lake on a csr = true page has server HTML to adopt. | dev warning, lake_mounted_without_html. It renders empty. | Keep it in a layout that persists, or serve the route csr = false. |
Server islands and held regions
A server island’s HTML, and a held region’s, is fetched from a signed endpoint. Server islands and Held regions cover the limits in detail.
| Rule | If you break it | Fix |
|---|---|---|
A server island that takes ogygiaFallback declares it in its props. | svelte-check flags the call site. | let { site }: Fallback<{ site: string }> = $props(), with Fallback from ogygia. |
| A server island’s props fit in its URL: 8192 characters once encoded. | server error, hole_props_too_large | Pass an id and look the record up on the server. |
| A server island renders on the server, with the same props on both sides. | dev warning, hole_without_address. A hole made in the browser keeps its fallback. | Keep it out of browser-only branches. |
keepFallback() runs in a server island that isn’t inside an island. | server error, keep_fallback_inline | Move the region into the page, a layout or a lake. |
| A held region whose component is imported plainly is awaited before it leaves the server. | server error, held_region_plain_import | await region(…), or mark the import with { region: 'raw' } or a wake. |
region() on a region: 'raw' component runs on the server. | browser error, raw_region_on_client | Build it in a load, a remote function or a render. |
A region’s version is a number, a Date or an ISO date string. | server or browser error where region() is called, region_version_invalid | Pass row.updatedAt or a counter. |
A promise handed to <Region of> has a placeholder snippet. | dev warning, region_promise_no_placeholder. Nothing shows until it resolves. | Add {#snippet placeholder()}. |
A render: 'live' lake sits inside an island. | dev warning, live_region_no_host. It never refreshes. | Wrap it in a wake: 'load' island. |
A handle in front of ogygia.handle() lets the endpoint (/__ogygia__) through. | browser warning, region_answer_redirected. The fallback stays. | Exempt the endpoint path in that handle. |
A render: 'live' lake gets no children, no bind:, no event attribute and no function prop. | build error, region_import_invalid | Pass plain data props and put the markup inside the component. See Lakes. |
A render: 'live' lake’s props serialize and fit 8192 characters once encoded. | server warning, live_props_not_serializable. It renders but never refreshes. | Pass an id and look the record up on the server. |
A server island or live region reads only page.data keys a server load returns. | dev warning, outside_page_data_key. The key reads undefined. | Return the key from a server load, or pass it as a prop. See Regions rendered outside the page. |
A server island (or a server router page) styled with <style lang="scss"> has sass or sass-embedded installed. | build warning, sass_missing. Its CSS ships as written. | Install sass-embedded or sass. |
| A server island’s render doesn’t throw. | server warning, region_render_failed. The hole’s request gets a 500 and keeps its fallback. | Catch the error in the component, or fix what it names. |
| A server island’s render finishes within 10 seconds. | server warning, region_render_abandoned | Give a slow upstream fetch its own timeout. |
Nesting
One rule decides nesting: the closest marked parent wins. Nest regions inside each other has the full table.
| Rule | If you break it | Fix |
|---|---|---|
| An island inside an island hydrates with the outer one. | dev warning, nested_island_with_parent, nested_region_rides_parent. Its own wake is ignored. | Put a lake (wake: 'none') between them. |
| A server island inside an island renders inline, as part of the island. | dev warning, nested_server_island_inline | Move it out of the island, or into a lake inside it. |
| A server island makes no JavaScript of its own. | No code: it never hydrates. | Nest a wake island inside its component. |
Macros
import.meta.og.* calls are rewritten by the build, so the build has to read their arguments. Macros has the shared rules.
| Rule | If you break it | Fix |
|---|---|---|
| A path or name argument is one plain string, written out. | build error, call_arg_not_literal, call_arg_interpolated, call_arg_in_expression | Write the whole string; no variables or ${}. |
A plugin’s macro is called in a <script> or a .ts module, not in markup. | build error, macro_in_markup | Call it in the script and use its value in the markup. |
The plugin that compiles a macro is listed (bake(), image(), content()). | build error, macro_needs_plugin | List the plugin the message names. |
A macro is used in your app’s source, or in files a package lists in ogygia.files. | build error, macro_outside_app | Declare the file in the package’s ogygia.files. |
import.meta.og.source(fn) initializes a top-level export const. | build error, macro_source_misuse | export const loadDoc = import.meta.og.source(fn). |
import.meta.og.store(factory) takes one factory that returns a store on every path. | build error, macro_store_misuse; build warning, macro_store_returns_non_store. ogygia/types doesn’t declare store yet (#2275); declare it yourself, as Add the types shows. | Pass one inline factory that returns a store on every path. |
import.meta.og.bake(fn) takes one inline, self-contained function whose result devalue can write. | build error, macro_bake_arity, macro_bake_not_function, macro_bake_eval_failed, macro_bake_not_serializable | See Rules. |
Packaging
An installed package’s files are compiled like your own only when the package declares them. Packaging shows the setup.
| Rule | If you break it | Fix |
|---|---|---|
A .ts or .js file in a package that marks imports is listed in its ogygia.files. | build warning, package_marks_undeclared. The marks do nothing. | Add "ogygia": { "files": [...] } to the package’s package.json. |
A .svelte file in a package that marks imports is listed too. | It compiles when the bundler reaches it, after the runtime’s features were picked: build warning, runtime_marks_late, or build error, server_features_late. | Same fix. |
ogygia.files is a list of strings, each inside the package. | build error, package_files_not_array, package_files_escapes | List package-relative paths or globs. |
Each ogygia.files path exists. | build warning, package_files_missing. The entry is skipped. | Fix or remove the entry. |
A library build never bundles ogygia. | The app gets a second copy that can’t resolve ogygia’s build-time modules. | Keep ogygia external (If your package imports ogygia). |
Production
Set the production variables walks through the setup these protect.
| Rule | If you break it | Fix |
|---|---|---|
OGYGIA_SECRET is at least 16 bytes. | build error, secret_too_short; server error from handle({ secret }), handle_secret_too_short | openssl rand -base64 32. |
Every deployment that serves your pages or your endpoint has the same OGYGIA_SECRET. | server warning, secret_missing (no secret), build_key_prerender (while prerendering); server error, logged, secret_missing_at_runtime (the build had one, the server doesn’t). Holes are refused: browser warning, region_answer_denied (foreign-key). | Set it in the server’s environment, or pass it to handle({ secret }). |
The server gets one secret and one endpoint path, from one handle(). | server error in dev, logged in production, secret_conflict, islands_endpoint_conflict | Call ogygia.handle() once. |
| The secret, and modules that sign with it, stay out of browser code. | build error, secret_in_client_chunk | Move the import into a server-only file. |
| Behind a proxy, your adapter knows which header holds the visitor’s address. | server warning, rate_limit_shared_address. Every visitor shares one budget, so once it runs out they all get 429. | adapter-node: ADDRESS_HEADER, with XFF_DEPTH. See rateLimit. |
ORIGIN is set on adapter-node, or wherever a proxy rewrites the host. | Kit answers commands, remote functions and form posts with 403. | Set ORIGIN to the public origin. |
| The deploy ships the server output whole. | server error, logged once, island_deps_handoff_missing. Holes render unstyled and nothing is preloaded. | Ship og-region-deps.json beside the server output, or let the build inline it. |
A page cached past maxPageAge doesn’t get its holes. | The endpoint answers 403 (x-ogygia-deny: renew-window) and the hole keeps its fallback. | Raise maxPageAge to your CDN’s longest cache life. |
Feature packages
Each package checks its own wiring. The most common ones are below; each package’s pages list the rest.
| Rule | If you break it | Fix |
|---|---|---|
A rewrite() handle has rewrite() from @ogygia/rewrite/vite listed, and comes before ogygia.handle(). | server error on every request, rewrite_plugin_missing, rewrite_after_ogygia | See Rewrite. |
An HTML pass is a rewrite() handle, not handle({ transform }). | server error, handle_transform_moved | sequence(rewrite({ page: transform }), ogygia.handle()). |
postrender.handle() has postrender() listed in vite.config. | server warning, postrender_handle_unlisted. Nothing is stored. | See Postrender. |
A plugin’s key in a page’s export const config (postrender) is a literal: true, false, a number, a string or null. | build error, kit_config_not_literal | Write the value itself, not a variable or a call. |
A flag read on the server has flags() listed. | server warning, flags_plugin_not_running. A stored page could keep one variant. | See Flags. |
A content collection lives in server-only code (.server.ts, src/lib/server/, .remote.ts). | build warning, content_collection_not_server_only, content_leaked_to_client | See Collections. |
import.meta.og.loader.* is called in a script module, not a component. | build warning, content_loader_in_component | Define the collection in a .server.ts file. |
federate() that exposes pages or widgets has a public key for each peer. | server warning, federation_open_without_keys. No caller can be checked, so every call gets a 401. | Add peer keys, or open: true when something in front checks callers. See Fail closed. |
| The dock stays out of production builds. | build warning, devtools_on_in_build | List devtools() only when mode !== 'production'. |
Dev vs production
Some behavior differs between vite dev and a build, so a data flow that works in dev can still break in production. Check these against vite build and vite preview:
- Query seeding. In a build, query results the server render awaited are written into the page and an island reads them instead of fetching. In dev the island fetches again (Why the island doesn’t fetch twice).
- Dev-only checks. Every dev warning above, including
prop_mutation, runs only on the dev server. A production build doesn’t warn, so the mistake fails quietly there. - Internal rules. ogygia also checks its own invariants in dev and in builds made with
OGYGIA_RULES=1. A message whose code starts withrule_is one of those: report it, with the page that shows it.