Troubleshooting
webjs's no-build, isomorphic-module model produces a few error signatures you have not seen in a bundled framework: a module that throws at LOAD rather than at call, a 500 from a stray backtick, a strip-time failure that points at a lint rule. This page is keyed by SYMPTOM. Find the error text or the behavior you are seeing, then read the cause and the fix. Most of these are also caught ahead of time by webjs check, so run it first.
"Cannot import X from browser code. This file is server-only"
Symptom: the page goes blank and the browser console shows an error thrown at module load, naming a .server file, before any of your code runs.
Cause: you imported a server-only utility (a .server.{js,ts} file with NO 'use server' directive) directly into a component, or into a helper a component imports. A page, layout or boundary may import it freely, since route modules run only on the server and never load in a browser. The dev server resolves that browser import to a stub whose body throws at the top level, so it fails the instant the module loads, not when you call the function. This is deliberate: it keeps the server source (your database connection, secrets, node:* usage) off the client.
Fix: never import a no-'use server' util straight into client-bound code. Use it INSIDE a 'use server' action, a route.{js,ts} handler, or middleware.{js,ts} (all server-only), and have the page call that action. A page reaches server logic through an action whose RPC stub loads safely on the client. See Server Actions. This is framework invariant 1 (the .server boundary). The no-server-import-in-browser-module check rule catches this ahead of time, on any component (or helper a component imports) that loads in the browser; a page, layout or boundary never is, and neither is a server-only component in a .server file. A TYPE-ONLY import type { Row } from './x.server.ts' is exempt, because the TypeScript stripper erases it before it reaches the browser, so sharing a derived row type from a .server.ts is safe and is not flagged.
A 500 in production from an html template that worked in dev
Symptom: a page renders in dev but 500s in production, or throws a cryptic JavaScript parse error near a template.
Cause: a backtick character appears inside an html`...` (or css`...`) template body, even inside a CSS or HTML comment. A nested backtick closes the tagged-template literal at JavaScript parse time, so the rest of the file is misparsed.
Fix: remove the backtick from the template body. If you need a literal backtick in rendered output, build it from a string expression (${'`'}) rather than typing it inline. This is framework invariant 9.
A 500 at strip time pointing at no-non-erasable-typescript
Symptom: a .ts file 500s with a message about TypeScript stripping and the no-non-erasable-typescript rule, or the server refuses to start naming a required Node version.
Cause: WebJs strips types with Node 24+'s built-in module.stripTypeScriptTypes, which only erases TYPES. Non-erasable syntax (an enum, a namespace with values, a constructor parameter property, a legacy decorator with emitDecoratorMetadata, or import = require) has no type-only form to strip, so it fails. The Node-version variant means you are on Node below 24, where the built-in strip and recursive fs.watch are unavailable.
Fix: set compilerOptions.erasableSyntaxOnly: true in tsconfig.json so the compiler rejects these at edit time, and use the erasable equivalents (a const object plus a union type instead of an enum, an explicit field plus assignment instead of a parameter property). Upgrade to Node 24+ for the version error. See TypeScript. This is framework invariant 10, enforced by the erasable-typescript-only and no-non-erasable-typescript check rules.
"Invalid or unexpected token" at an @, or a module refused for a decorator
Symptom: a component written the Lit way (@customElement('my-el'), @property() count = 0, @state(), @query('#x')) never loads. Node and the browser report a bare SyntaxError: Invalid or unexpected token, Bun reports ReferenceError: property is not defined, and in dev the module request answers a 500 naming the decorator.
Cause: WebJs serves your source with no build step, and decorators are not erasable TypeScript. The type stripper passes them through untouched, and no JavaScript runtime WebJs targets runs them, so the module fails to parse. This holds for .js files as much as .ts.
Fix: write each decorator the WebJs way. @property() becomes an entry in Lit's static properties = { count: { type: Number } } plus declare count: number (or the WebComponent({ count: Number }) factory), with the default set in the constructor. @state() becomes { state: true } in the same map. @customElement('my-el') becomes MyEl.register('my-el') after the class. @query('#x') becomes a getter, get el() { return this.renderRoot.querySelector('#x'); }. The no-non-erasable-typescript check rule finds every decorator at edit time and prints the fix for that decorator; an @click in a template, an @media in a css block, and a JSDoc @param are never mistaken for one. See TypeScript.
"does not provide an export named" for an @webjsdev/core import
Symptom: a page or component fails to load with SyntaxError: The requested module '@webjsdev/core' does not provide an export named 'LitElement' (Bun: Export named 'LitElement' not found), or the same for customElement, property, PropertyValues, or TemplateResult.
Cause: the name is not a runtime export of that module. Three Lit habits produce it. LitElement and ReactiveElement do not exist (the base class is WebComponent). A decorator function does not exist (WebJs has no decorators). And a TYPE such as PropertyDeclaration imported without type survives the type stripper as a real import, which ESM then refuses to link.
Fix: extend WebComponent from @webjsdev/core; declare properties in static properties and register with MyEl.register('my-el'); import a type with import type { PropertyDeclaration } from '@webjsdev/core' (or import { type PropertyDeclaration }). The core-imports-exist check rule reads the installed core's real export surface, flags every such import at edit time with the fix for that name, and points a name imported from the wrong subpath (Task from @webjsdev/core/directives) at a module that exports it. In dev the overlay prints the same fix.
An SSR crash naming document, window, or a DOM method
Symptom: the server render throws naming a browser global or an HTMLElement method (document, window, localStorage, this.querySelector, this.classList, this.attachShadow), and the page never reaches the browser.
Cause: a component touched a genuinely browser-only global in its constructor or render(), both of which run during SSR. The SSR pipeline constructs the component and calls render() on the server, where the live DOM does not exist. (The attribute methods, closest(), and the host IDL reflections ARE backed by a server shim and do not crash; only the live-DOM surface does.)
Fix: move browser-only reads (localStorage, viewport, matchMedia, navigator.*) into connectedCallback, which runs only in the browser, then write the value to a signal to refine the first paint. Defaults for the first paint go in the constructor; server-known data comes through the page function as a prop. See Components and Progressive Enhancement. The no-browser-globals-in-render check rule catches this ahead of time.
A controller's hostUpdate() is reported as skipped during SSR
Symptom: the server logs that a controller's hostUpdate() threw during SSR and was skipped, and the component's first paint lacks whatever that controller derives.
Cause: controllers' hostUpdate() runs on the server too, as in Lit's SSR, so derived state reaches the first paint. A controller written for the browser (reading window, measuring the DOM) throws there. WebJs isolates each controller, logs once per controller class, and keeps rendering.
Fix: guard the browser work with if (isServer) return; (isServer from @webjsdev/core), or move it to hostConnected() or hostUpdated(), which never run at SSR. See Controllers.
A Task's function receives an array instead of a value
Symptom: task: async (id) => fetchItem(id) requests /items/7 as /items/[7] or similar, or a destructured argument is undefined.
Cause: the task function is called as task(args, { signal }) with the whole array args() returned, exactly as Lit's Task calls it.
Fix: destructure it, task: async ([id], { signal }) => fetchItem(id, { signal }). See Task.
A context consumer never updates after the provider's setValue()
Symptom: a ContextConsumer reads the provided value once and keeps it after the provider changes.
Cause: subscribe defaults to false, as in Lit, so the consumer asks once per connection.
Fix: pass subscribe: true (new ContextConsumer(this, { context, subscribe: true })). A consumer that stays undefined because its provider upgrades later needs a ContextRoot attached early (new ContextRoot().attach(document.body)), which replays subscribing requests. Context keys match by identity: createContext('theme') returns the string key, so two modules creating the same string share it. See Context.
A literal template throws "must be a 'literal' result"
Symptom: a static-html template from @webjsdev/core/static-html throws when a tag name comes from a variable.
Cause: as in Lit, a hole in literal`...` accepts only another literal result, so a runtime string cannot become markup by accident.
Fix: wrap a trusted runtime string in unsafeStatic(value), and never pass user input through it. See Directives.
A custom element renders but never reacts to a property change
Symptom: the component paints correctly on first load, but assigning a reactive property later does not re-render it.
Cause: you wrote a class-field initializer for a declared reactive property (count: number = 0 or count = 0 alongside WebComponent({ count: Number })). Under modern class-field semantics that compiles to a define on this AFTER super(), which overwrites the framework's reactive accessor, so subsequent assignments bypass the update.
Fix: remove the class-field initializer and set the default by assigning in the constructor after super(). See Components. The reactive-props-no-class-field check rule flags this.
A component method named append, remove, or appendChild silently never runs
Symptom: a handler or helper you defined on a component (an append() click handler, a remove() method) does nothing when called, with no error thrown, and TypeScript did not complain.
Cause: WebJs instruments the native DOM mutation methods on every light-DOM host to keep the slot API live, and it installs those interceptors as own properties ON THE ELEMENT INSTANCE. An own instance property shadows a method defined on the class prototype, so the framework's interceptor wins and your same-named class method is never reached. The instrumented names are append, prepend, before, after, replaceWith, replaceChildren, remove, appendChild, insertBefore, removeChild, and replaceChild. TypeScript does not catch it because a shorter override (zero or one argument) is assignable to the native signature.
Fix: rename the member to a non-native name (appendRow(), removeItem()) and update its call sites. Only these native mutation members are affected; render() and the lifecycle hooks are meant to be overridden. The no-shadowed-native-member check rule catches this ahead of time (it flags only a real instance method, never a static member, a nested-object property, or a static shadow = true component, whose native shadow slots are not instrumented). See Components.
An error saying a function was interpolated into action=, or that it is not a server action
Symptom: a render fails with a function was interpolated into action=, or with the function in action= is not a server action. The supported binding is an unquoted action=${fn} on a <form>, where the function is imported from a 'use server' module; the first message means the shape was a near-miss the renderer will not stringify, and the second means the shape was right but the function is not an action the server can run. Where that surfaces depends on which render threw. From a page or layout it propagates, so the nearest error boundary catches it and the message is visible. From inside a component it does not: per-component SSR error isolation contains it, so dev renders an error box in place of the component while production renders the component empty and the page still returns 200. A form that has silently vanished in production, with no error anywhere, is the same bug wearing a disguise; check the server log for the message. In neither case is the action's source emitted.
Two refinements on "renders the component empty", because both send people looking in the wrong place. The isolation replaces the element through its matching closing tag, so anything slotted into that component disappears with it: put the bad form in a shared header or shell and every page returns 200 with an empty body, which reads like a routing failure rather than one broken component. And on a route with a loading.ts, the page renders inside a Suspense boundary after the 200 and the shell are already flushed, where a throw is currently swallowed with no server log and no error report; the visitor gets chrome and a blank body, and with JS off the loading skeleton simply stays. That silence is why the log line you are looking for may not exist on that path; it is a known gap rather than intended behaviour.
Cause: during SSR an imported 'use server' action is the REAL function (the RPC stub exists only in the browser). The supported binding resolves that function's identity instead of stringifying it, but in any OTHER shape action= is an ordinary attribute hole, so stringifying it would write the action's whole body into the HTML every visitor downloads: its logic, the query shapes it builds, and any literal written inside it, a connection string or internal path included.
Assume outer values are exposed too. On Node, Function.prototype.toString returns source text, so a module-scope const the body reads appears only as its identifier. That is NOT a guarantee you can rely on: Bun transpiles a module before the engine sees it and can fold a module-scope string literal straight into the body, so the same action reports Authorization: "Bearer sk_live_…" where Node reports Bearer ${VENDOR_API_KEY}. Do not go looking for the rule that decides when it folds. It is a transpiler's internal choice rather than a documented boundary, and two modules on the same Bun version can differ. Whether a secret in an outer binding escapes therefore depends on the runtime and on how the module was transformed, and it is not a boundary worth building a habit on. Treat everything reachable from the action as exposed, which is what the refusal assumes. WebJs refuses rather than emitting it. The refusal covers every shape that is not the binding: an unsupported formaction= shape, action=${fn} on a tag that is not a <form>, a quoted action="${fn}" or mixed action="/x/${fn}" (quoting turns a binding hole back into a plain attribute), and a function wrapped in an array (action=${[fn]}), which stringifies its elements the same way. One shape it does not cover: a hole inside an HTML comment is emitted raw by the renderer, so commenting a working form out does NOT disable the interpolation, it turns the binding back into a leak. Delete the form rather than commenting around it. .action=${fn} on a native form is refused at SSR too, even though the property is dropped there, so a page cannot render clean on the server and then throw on hydration, where the reflected IDL attribute would carry the source into the live DOM.
Two things stay legal, because neither stringifies its value: a custom element's .action property (an author-defined property, not the reflected IDL attribute a native <form> has, so <my-el .action=${fn}> is fine), and an unquoted @action=${fn} event listener, where a function is exactly what is wanted. One qualification on the first: that holds for a plain property, and NOT if the component declares it reflect: true. Reflection is a separate path that does not pass through the template commit sites this guard covers, so it carries its own guard: a reflecting action prop removes its attribute and warns rather than emitting the function's source. That covers every function-valued reflected prop rather than an action one, and it is described under "A reflected attribute is missing, with a warning that the property holds a function" below. Quoting a binding hole turns it back into a plain attribute, so @action="${fn}" IS refused; that is the practical reason invariant 4 requires @, . and ? holes to be unquoted. ?action=${fn} is refused as well: it never leaked, but a truthy function would silently emit a bare action="". The HTML spec requires action to be a valid non-empty URL when the attribute is present, so an empty one is a conformance error rather than merely a pointless value. Deleting the attribute is not the fix here, though: a page has no action export, so a form that binds nothing and posts is the 405 described below, conformant and still broken (a bare GET form merely re-renders the page). Bind the action, <form action=${fn}>, which is what emits the identity the dispatcher reads.
Fix: write the binding exactly: an unquoted action=${importedAction} on the <form> itself, or formaction=${importedAction} on a <button> inside a bound form, with the function imported from a 'use server' module. Use a <button> rather than an <input type="submit">, whose value is both the identity channel and the visible label. Do not add submitter name, value, form, or static formaction attributes. Do not add method or enctype; the renderer supplies both. A string action is unaffected. See Server Actions and Progressive Enhancement.
A form submission answered with a 405
Symptom: submitting a form returns 405 Method Not Allowed with Allow: GET, HEAD, and the page itself renders fine on a GET.
Cause: the form binds no action. A page has no action export, so a bare <form method="post"> has nothing to run: the url exists and only renders, which is what the 405 says. The other way to get one is binding an action whose file declares export const method = 'GET'; a GET action rides its arguments in the url and skips the CSRF check, so it cannot answer a form POST. That case answers Allow: GET, and webjs check's form-action-not-a-get-action rule catches it before it ships.
Fix: bind the action (<form action=${submitFeedback}>), or drop the method export from the action's file so it is an ordinary POST.
Posting by hand (curl, a script) to a page whose form IS bound answers the same 405 when the request leaves out the form's hidden __webjs_action field, and in development the response body says so (production answers the bare status). Copy that field's value from the rendered form and send it with the others, or in a test use submitForm(), which reads it from the page for you.
A button submits and the page just re-renders
Symptom: clicking a formaction=${action} button reloads the same page with a 200, nothing was written, no error appears anywhere, and the address bar has grown a ?__webjs_action= parameter.
Cause: the submission went out as a GET, so it carried no body and the identity rode the query string instead, and a GET at a page url just renders the page. That is why there is no 405 and no log line. A submitter you bound with formaction=${action} does NOT reach this on its own: the renderer gives it formmethod="post", which overrides the form's method per HTML, so it posts correctly inside a form that is unbound, method-less, or even method="get". What reaches this is a formmethod="get" or method="get" written by hand and deliberately honoured, or a hand-authored form carrying the reserved field.
Fix: remove the explicit formmethod="get" or method="get" from the submission path you meant to write. Two runtime signals find it: in dev the browser console carries one [webjs] error at submit time naming the fix, and in production the onError hook receives the fingerprint with err.code === 'WEBJS_FORM_SUBMITTED_AS_GET'. The 405 case has its own code, WEBJS_FORM_ACTION_MISSING. Neither changes the response.
A render fails on a button's formmethod or formenctype
Symptom: a page fails at render with <button formenctype="text/plain" formaction=${action}> cannot work, or the same message naming formmethod.
Cause: that button BINDS an action and also tells itself to submit in a way the action could never read. A bound action needs a POST body the server can parse as multipart/form-data or application/x-www-form-urlencoded. A GET sends no body at all, text/plain is flagged by the HTML spec as not intended for machine parsing, and formmethod="dialog" dismisses a <dialog> rather than submitting. The renderer supplies formmethod="post" and the enctype on a bound submitter, so writing a conflicting value on the same button is a straight contradiction.
Fix: drop the attribute and let the renderer supply it, or drop the binding. Note this fires only on a button that binds an action. A button that binds NOTHING keeps whatever you wrote, because a submitter's override is legal HTML and means what you typed. If such a button is inside a bound form, its override defeats that form's action, and the page will log a console error at submit time in dev saying the submission is carrying an identity it cannot deliver.
A per-button action does nothing and the page just reloads
Symptom: clicking a formaction=${action} button re-renders the same page with a 200, nothing was written, and there is no error anywhere.
Cause: the submission went out as a GET, so the action identity rode the query string instead of a request body and no action ran. Before the submitter carried its own formmethod this happened whenever the enclosing form was unbound, which is fixed. What can still cause it is an explicit override you wrote: a formmethod="get" on the button that was pressed, or on the form, wins over everything else by native precedence and WebJs honours it rather than refusing it.
Fix: remove the formmethod="get", or move that button out of the form whose action you wanted to run. In dev the client logs a console error naming this at submit time; in production it reaches your onError hook as WEBJS_FORM_SUBMITTED_AS_GET.
A form re-renders asking you to submit again
Symptom: a submission comes back at 422 with a message about the page having been updated, and the typed values still filled in.
Cause: the identity the form submitted names an action file this build does not have. That is deploy skew: the form was rendered by an older build and submitted against a newer one, so the hash no longer resolves. Re-rendering the page is the deliberate answer, because a 404 would discard everything typed and a silent success would report a write that never happened.
Fix: nothing to fix; submitting again works, and the values are still there. If you see it constantly rather than around a deploy, check that the app is not being served by two processes on different builds.
A reflected attribute is missing, with a warning that the property holds a function
Symptom: a property declared reflect: true renders no attribute at all, and the console carries reflect:true property "x" on <my-tag> holds a function (or an array carrying one), which has no HTML attribute representation. The warning appears in the server log for an SSR render and in the browser console for a client-side assignment, since both run the same reflection path.
Cause: the property was assigned a function, and a function has no HTML attribute representation. Writing one anyway is worse than dropping it. String(fn) is the function's SOURCE, so a reflected 'use server' action would put its whole body, closure secrets included, into the HTML every visitor downloads, and an Object-typed or Array-typed property would get JSON.stringify(fn), which is undefined and lands in the attribute as that literal four-character string. So reflection treats a function like null and removes the attribute. This is not specific to a property named action; it holds for every name, because the leak was the generic reflection path stringifying whatever it was handed.
Fix: decide what the attribute was for. If the function was meant as a callback, drop reflect from the declaration and keep it as a plain property or a signal, which is where a function belongs. If the attribute is genuinely wanted, assign a string that names the behaviour rather than the function itself. If you own the serialization and know what you are doing, a custom converter.toAttribute runs before this guard and is left alone, so it still receives the function and decides for itself. To bind a server action to a form, use <form action=${importedAction}>, which resolves the action's identity instead of stringifying it. See Components.
A reflected attribute is missing, with a warning about a value JSON.stringify cannot serialize
Symptom: an Object-typed or Array-typed property declared reflect: true renders no attribute, and the console carries reflect:true property "x" on <my-tag> holds a value JSON.stringify cannot serialize (a cycle, a BigInt, or a throwing toJSON), so it has no HTML attribute representation. The SSR form of this arrives differently and is the one people usually hit first. Before the guard existed the throw was contained by per-component SSR error isolation, so in dev the component was replaced by a red error box carrying the message, and in production it rendered EMPTY on a page that still returned 200 with the cause only in the server log. A component that has silently vanished in production is therefore the same problem wearing a disguise.
Cause: the value cannot pass through JSON.stringify at all. Three shapes do this in practice: a cycle (an object or array that reaches itself, which arrives from a parent/child graph, a linked node, a memo table, or anything a library hands back with a back-reference), a BigInt anywhere inside the value, and an author toJSON() that throws. An HTML attribute is a string, so a value with no string form has no attribute representation, and reflection removes the attribute instead. This is a different case from a JSON-typed value merely CARRYING a function, which keeps its data: [1, 2, fn] serializes to [1,2,null] and reflects normally. The property itself is untouched and still holds the value in memory; only the attribute goes, because the attribute is a projection of the property rather than the source of truth for it. On the read side, an attribute that is PRESENT but not parseable JSON reads back as null rather than as the raw string. An attribute that is absent is not read at all, so the property keeps its constructor value instead.
Fix: break the cycle before assigning, or reflect a derived scalar instead. A reflected attribute is usually wanted for CSS or a selector, and an id or a count serves that better than a whole graph: declare selectedId: prop(String, { reflect: true }) and keep the graph on a plain non-reflected property or a signal. For a BigInt, convert it to a string at the boundary. For a throwing toJSON(), fix the method or drop reflect. If you own the serialization, a custom converter.toAttribute runs before this guard and is left entirely alone. See Components.
An error saying .get is not a function on a signal field
Symptom: a component renders once, stops updating after some interaction, and the next render throws TypeError: this.open.get is not a function.
Cause: something assigned to a signal field (this.open = true, this.count++, or el.open = false from outside) instead of calling .set(). The assignment replaces the signal object with a plain value, so the component stays subscribed to the old signal, which never changes again, and the next read calls .get() on the value.
Fix: write through the signal, this.open.set(true) (or this.count.set(this.count.get() + 1)), and declare every signal field readonly (readonly open = signal(false), or readonly #open for internal state) so TypeScript rejects the assignment. The no-signal-field-assignment check rule flags it inside the declaring class, plain .js included. See Components.
A <style> or <script> inside a component paints, then empties on hydration
Symptom: a component renders html`<style>${rules}</style>` (or a <script> with a hole). The server-rendered page looks right, then the element's styles or script vanish once the component hydrates.
Cause: <style> and <script> are raw-text elements, so the client renderer cannot place a binding inside them and treats the hole as a no-op. The server writes the interpolated text, but the client renders the element empty.
Fix: move component CSS into static styles with static shadow = true, or use Tailwind utilities in light DOM. A page or layout never hydrates, so it may interpolate a css result into <style>. The no-interpolation-in-raw-text-element check rule flags the component shape at edit time. See Styling.
A Boolean property is on even though the attribute says "false"
Symptom: <my-dialog open="false"> renders open, and the console warns that the property received the attribute value "false".
Cause: a Boolean property reads its attribute by presence, as HTML boolean attributes and Lit do. Any value, "false" included, means on.
Fix: leave the attribute out, or bind it with ?open=${isOpen}, which writes the attribute only when the value is true. If a component genuinely needs a tri-state or a textual "false", declare the property String and compare it yourself. See Components.
A component's first paint is empty until JavaScript runs
Symptom: a component shows a blank or skeleton state on first load and fills in only after hydration, and with JavaScript disabled it stays empty.
Cause: initial data is fetched in connectedCallback or firstUpdated, neither of which runs during SSR, so the server-rendered HTML is empty by design. This breaks progressive enhancement.
Fix: fetch the data on the server in the page function and pass it down as a prop (.prop=${richObject} for a custom element, which round-trips through SSR, or an attribute for a native element). Reserve connectedCallback for genuinely browser-only refinement. See Progressive Enhancement.
A whole page gets replaced on a frame navigation
Symptom: clicking a link inside a <webjs-frame> replaces the entire document instead of just the frame (for example an auth redirect returning a login page).
Cause: the navigation response did not contain a <webjs-frame> with the requested id. Rather than silently swapping the whole document, WebJs now fires a cancelable webjs:frame-missing event and leaves the frame unchanged (with a console warning).
Fix: make sure the response for a frame-scoped navigation includes the matching frame, or listen for webjs:frame-missing on document and decide the outcome yourself (the event detail carries { frameId, url, document }; call preventDefault() to take over, for example a full navigation with navigate(detail.url)). See the <webjs-frame> section in Client Router.
A vendor module 404s after deploying under a sub-path
Symptom: the app works at the origin root but, when mounted under a sub-path (example.com/app/) behind a proxy that does not strip the prefix, the importmap and module URLs 404 and the page never hydrates.
Cause: the framework-emitted URLs (importmap targets, the boot module specifiers, the RPC endpoint) default to origin-root paths.
Fix: set "webjs": { "basePath": "/app" } in package.json. WebJs strips the prefix at ingress and prefixes every framework-emitted URL, so module resolution works under the mount. See Configuration.
A browser import of an app file returns 404
Symptom: a module the browser tries to fetch returns 404 even though the file exists.
Cause: only files reachable from a browser-bound entry (a component, or instrumentation-client.ts) through the import graph are servable. A page, layout or boundary is never served, since it runs only on the server, and neither is a file only a page imports. A file nothing client-side imports, a hand-rolled scripts/ helper, or a .server file's source returns 404 by construction, the same posture as a bundler manifest.
Fix: import the module from a component (or instrumentation-client.ts) so it enters the graph, or, if it is server-only, keep it behind the .server boundary and reach it through an action. See No-Build Model.
A REST endpoint for a server action 404s
Symptom: a 'use server' action is RPC-callable from a component but curling a path returns 404.
Cause: a server action is reachable over RPC, not over an arbitrary REST path on its own. REST endpoints go through route.ts (the framework's HTTP handler).
Fix: add an app/<path>/route.ts that imports the action and calls it, or wrap it with the route() adapter from @webjsdev/server (export const POST = route(myAction)). See Server Actions.
A component's static styles or shadowRootOptions have no effect (and a console error)
Symptom: a static styles = css`...` block does not style the component at all and the framework logs an error once per class (in the dev server's terminal during SSR and in the browser console), or static shadowRootOptions = { delegatesFocus: true } changes nothing.
Cause: static styles is adopted through a shadow root and shadowRootOptions configures one, but the component is in light DOM (the WebJs default, the reverse of Lit's), which has no shadow root, so neither is applied.
Fix: add static shadow = true to scope the styles, or use Tailwind utilities (unique by construction), or, if you keep custom CSS in light DOM, prefix every class selector with the component tag name (framework invariant 7 for light-DOM CSS). The static-styles-need-shadow and shadow-options-need-shadow check rules flag both shapes at edit time. See Styling.
"Value passed to 'css' must be a 'css' result or a number"
Symptom: a component module throws at load with this message, pointing at a css`...` template whose hole holds a string (a colour from a constant, a token from a config object).
Cause: as in Lit, a css hole takes only another css result or a number, so arbitrary text can never be spliced into a stylesheet by accident.
Fix: make the shared value a css result (const accent = css`#e11d48`) and compose it, or wrap a trusted string in unsafeCSS() from @webjsdev/core. Never pass user input through unsafeCSS(). See Styling.
"createRenderRoot() returned a shadow root, but the class does not declare static shadow = true"
Symptom: a component throws on connect with this message, or with its mirror image (the class declares static shadow = true but createRenderRoot() returned something else).
Cause: the override calls this.attachShadow() itself, the way a Lit component switches to a custom shadow root. WebJs renders a component on the server before any createRenderRoot() can run, and decides between inline markup and a Declarative Shadow DOM template from static shadow, so the server render and the client root would disagree.
Fix: set static shadow = true and put the attachShadow() options in static shadowRootOptions, then drop the override. An override that only post-processes the root can keep calling super.createRenderRoot(). Lit's createRenderRoot() { return this; } needs no change, because light DOM is already the default. See Components.
A vendored package throws "X is not exported" or a missing-symbol error at runtime
Symptom: two npm packages that work together locally throw at runtime in the browser, typically a missing-export or undefined-symbol error from one package reaching into another (for example @codemirror/lint calling into a @codemirror/view that is pinned an older minor than it needs).
Cause: the importmap pins each package to one version, and one pinned package declares a dependency or peer range on another pinned package that the pinned version does not satisfy. The graph is INCOHERENT: package A needs view ^6.42.0 but the importmap pins view@6.39.16, so a symbol A expects is absent from the older bundle. This can come from a hand-edited .webjs/vendor/importmap.json, a partial vendor pin, or a stale resolve.
Fix: run webjs doctor. The importmap-coherence check inspects the produced importmap (the live one AND the vendored .webjs/vendor/importmap.json, with the same verdict for the same dependency set) and warns naming both packages, the required range, and the pinned version. Align the versions: re-run webjs vendor pin to re-resolve a coherent set, or bump the lagging package in package.json and reinstall so the importmap pins a version every dependent accepts. See No-Build Model.
webjs dev exits saying the directory is not a WebJs app
Symptom: webjs dev or webjs start exits 1 with webjs dev: this directory is not a WebJs app, so there is nothing to serve.
Cause: the command was started where there is no app/ directory, usually a workspace root (a monorepo whose app lives in apps/web) or a folder inside the app. A server started there would answer 404 for every route, so it refuses instead. Inside an app, a route folder that happens to be named app (app/app/page.ts, a /app route) is refused too, with this directory is inside an app, not the app root, because it would be served as the app.
Fix: change into the app directory the message names and run the command there, for example cd apps/web && webjs dev. In a workspace this works with the CLI hoisted to the root node_modules, on Node and on Bun.
A webjs.dev.before / webjs.start.before step fails and aborts the boot
Symptom: the dev or prod server refuses to start, printing webjs dev: before-step failed (exit N): <command> (or webjs start: ...) and never serving.
Cause: a webjs.dev.before / webjs.start.before step (the scaffold ships webjs db migrate) exited non-zero. As of #550, webjs dev / webjs start run these one-shot steps to completion BEFORE serving (replacing the old predev / prestart npm hooks), and they ABORT the boot on a failure so the app never serves a stale client or schema. A bare webjs dev and npm run dev run the same steps, so this is not a "wrong command" problem.
Fix: run the failing command directly to read its real error (for the scaffold's steps, webjs db generate or webjs db migrate), fix the cause (a malformed db/schema.server.ts, an unreachable DATABASE_URL), then re-run. A local binary in a step (drizzle-kit, tailwindcss) resolves under a bare webjs dev the same way npm run resolves it (the ancestor node_modules/.bin dirs are on the step's PATH).
A 'use server' file's exports are not callable from a component
Symptom: you added 'use server' to a plain .ts file and imported one of its functions into a component, but the call fails or webjs check flags use-server-needs-extension.
Cause: the RPC boundary keys on the FILE EXTENSION, not the directive alone. A 'use server' directive in a plain .ts file is a lint violation, because the file router only treats .server.{js,ts} files as the server boundary. Without the extension the source would also be served to the browser.
Fix: rename the file to *.server.ts. The extension makes it server-only (source-protected) and the 'use server' directive makes its exports RPC-callable. See Server Actions. The use-server-needs-extension check rule catches this, and use-server-exports-callable flags a 'use server' file that exports no callable function (it registers nothing, so the RPC 404s silently).
A configured server action file with more than one function is rejected
Symptom: webjs check flags one-action-per-configured-file on a *.server.ts that exports a config (method, cache, validate, middleware) alongside two callable functions.
Cause: the HTTP-verb and caching config exports (export const method, cache, tags, invalidates, validate, middleware) attach to the ONE action in the file, so a second callable function makes the config ambiguous.
Fix: keep one callable function per configured action file (the convention is one function per action file regardless). Split the second function into its own *.server.ts. See Server Actions. The one-action-per-configured-file check rule enforces this.
A nested layout or page's <html> shell is dropped
Symptom: you wrote <!doctype> / <html> / <head> / <body> in a non-root layout or a page and the tags vanish from the output, or webjs check flags shell-in-non-root-layout.
Cause: the framework auto-emits the document shell around the whole composition, so only the ROOT layout (app/layout.ts exactly) may write its own shell. A nested shell ends up inside the framework's <body> and the HTML parser drops the stray tags.
Fix: remove the shell tags from the nested layout or page and return just the content. Move any <html lang> / <body class> customization to the root layout, which the framework respects and splices its required tags into. See Routing. The shell-in-non-root-layout check rule flags this, framework invariant 8.
An import of a symbol crashes at runtime, but the checker was green
Symptom: a named import resolves to undefined and crashes on first use (often after renaming or removing a schema table), and type-checking reports has no exported member while the correctness checker passed.
Cause: most check rules are lexical and do not compile types, so a stale import used to slip past. Dropping the example todos table while another module still imported it is the canonical case.
Fix: add the missing export, correct the imported name, or remove the import (and prune any orphaned module). The no-missing-local-import rule now flags a named value import of a symbol a resolvable app-internal module does not export, so it is caught before runtime. It is conservative by design (only app-internal specifiers, only named value imports, and it skips a module whose exports are not fully enumerable), so a re-export barrel and a 'use server' action file resolve normally. Type-checking alongside the correctness checker stays the belt-and-suspenders habit.
The server refuses to start naming no-page-route-conflict
Symptom: webjs start exits with [no-page-route-conflict], and in development every request answers a 500 with the same text and the error overlay shows it.
Cause: a page.ts and a route.ts answer the same URL, either in one folder or through a route group (app/(site)/about/page.ts beside app/about/route.ts). The route handler would shadow the page, so it could never render. Next.js refuses the same layout at build time.
Fix: keep one. Move the route handler under its own path (app/api/about/route.ts) or delete the page. webjs check reports the same problem ahead of time.
An import of next, react, or lit is refused (no-foreign-framework-import)
Symptom: webjs check reports no-foreign-framework-import, the dev server answers every request with a 500 naming the import (and the error overlay shows it), production readiness stays 503, or a server module fails to load with imports 'next/headers', a Next.js package.
Cause: a file imports next or next/*, next-auth, react or react-dom, lit, lit-html, lit-element, lit/*, @lit/* or @lit-labs/*, usually from habit. WebJs implements those APIs itself and never loads the packages: a Next import has nothing to resolve to, and a Lit import would load a second component runtime from the CDN beside WebJs's own. Every import form counts, import type included.
Fix: import the WebJs equivalent, which the message names. The common ones:
next/navigation(redirect,permanentRedirect,notFound,forbidden,unauthorized) becomes@webjsdev/core, and server code may import the same functions from@webjsdev/server; client navigation isnavigate()from@webjsdev/core.next/headers(cookies,headers) andnext/cache(revalidatePath,revalidateTag) become@webjsdev/server.next/serveris the platform: a route handler or middleware takes aRequestand returns aResponse.next-authbecomescreateAuth()from@webjsdev/server, which is Auth.js's API:export const { handlers, auth, signIn, signOut } = createAuth({ providers: [Credentials({ authorize })], secret }), mounted withexport const { GET, POST } = handlersinapp/api/auth/[...path]/route.ts.next/linkis a plain<a href>,next/imagea plain<img>, and types such asMetadatacome from@webjsdev/corewithimport type.lit,lit-htmlandlit-elementbecome@webjsdev/core(LitElementisWebComponent),lit/directives/*becomes@webjsdev/core/directives,@lit/contextbecomes@webjsdev/core/context, and@lit/taskbecomes@webjsdev/core/task.reactcomponents become aWebComponentclass. A*.server.tsmodule may still usereactorreact-dom(an email renderer, for example), since it never reaches the browser.
A render error naming className=, htmlFor=, or a tag like <Link> (no-jsx-attributes)
Symptom: a page or component throws className= in an html template is JSX, not HTML (or names htmlFor=, or a capitalised tag such as <Link>), and webjs check reports no-jsx-attributes.
Cause: an html template is HTML, not JSX. HTML reads className and htmlFor as unknown attributes, so the class never applies and the label never targets its control, and it lowercases <Link> into an unknown element that renders nothing. Both renderers refuse these when the template first compiles instead of rendering a silently wrong page.
Fix: write class= and for=. Render a custom element by its registered, hyphenated tag (<my-button>), and a link as a plain <a href>, which the client router already enhances.
A render error saying a function was interpolated into onclick
Symptom: a render throws a function was interpolated into the onClick attribute.
Cause: onClick=${handler} is React's spelling. In an html template an attribute is a string, so the function's source would be written into the HTML as an inline handler that runs in the global scope without its closure, and would ship the code to every visitor.
Fix: bind the event with @click=${handler} inside a WebComponent's render(). A string handler (onclick="go()") is plain HTML and is left alone.
A dev render error about an @event or .prop in a page or layout
Symptom: in development a page answers 500 with an @click event listener on <button> in a page or layout template (or a .value property binding).
Cause: pages and layouts render only on the server and never hydrate, so an event listener or a native-element property binding written in their template is dropped and never runs. In production it would silently do nothing; development makes it an error so you notice. The same applies to anything else rendered outside a component, an error.ts / not-found.ts boundary included, since those never hydrate either.
Fix: move the interactive markup into a component and render its tag from the page. The component's render() runs in the browser, where @click works. For a value that only needs to reach the HTML, write a plain attribute (value=${x}). A .prop on a custom element in a page is fine: it is serialized for the component to read when it hydrates.
A page.tsx route does not exist, or the server refuses to start naming no-jsx-route-file
Symptom: webjs start exits with [no-jsx-route-file], development answers every request with the same message, webjs doctor fails JSX_ROUTE_FILES, and webjs check reports no-jsx-route-file.
Cause: a routing file (a page, layout, route handler, boundary, middleware or metadata route) is written as .tsx or .jsx, the Next.js default. WebJs has no build step, so JSX is never loaded and the router would skip the file, leaving the route silently missing.
Fix: rename it to .ts (or .js) and return an html template from @webjsdev/core instead of JSX. Interactive parts become a WebComponent. See Routing.
An import './styles.css' is refused (no-css-import)
Symptom: webjs check reports no-css-import, development answers every request naming it, or a server module fails with imports a stylesheet.
Cause: importing CSS is a bundler feature, and WebJs has no bundler. The runtimes do not even agree on what happens: Node rejects the .css extension, Bun silently turns the import into a no-op on the server (the page renders unstyled), and the browser refuses a stylesheet as a module script, so the importing module never loads. WebJs refuses it the same way everywhere instead.
Fix: load a stylesheet with <link rel="stylesheet" href="/styles.css"> in the root layout (the scaffold links its Tailwind output this way), or scope CSS to a component with static styles = css`...` and static shadow = true. See Styling.
An inline 'use server' function is not a server action (no-inline-use-server)
Symptom: webjs check reports no-inline-use-server, or binding the function to a form throws is not a server action.
Cause: Next.js lets a function inside a page declare 'use server' as its first statement. In WebJs the server boundary is a FILE: the directive is honoured only at the top of a *.server.{js,ts} module. Inside a function body it is an ordinary string, so the function is not an action and has no identity a form could submit.
Fix: move the function into its own module, for example modules/posts/actions/create-post.server.ts, whose first line is 'use server'; export it and import it where it is used (<form action=${createPost}>). A page with 'use server' at its top is told the same, rather than to rename itself, because page.server.ts would stop being a page. See Server Actions.
A bound function in action= is refused
Symptom: rendering a form throws is a bound function that is not a server action.
Cause: the function in the hole was made with .bind, but not from a server action: a plain function, or one bound through Function.prototype.bind.call. Only an action's own .bind keeps the identity a form submits.
Fix: bind the imported action itself, <form action=${rsvp.bind(null, slug)}>, where rsvp is exported from a 'use server' module. The bound arguments arrive before the form input. See Passing an argument with .bind.
A process.env read flagged by no-server-env-in-components, including NEXT_PUBLIC_
Symptom: webjs check reports no-server-env-in-components on a component or on a module a component imports, or a NEXT_PUBLIC_ variable reads as undefined in the browser.
Cause: code the browser runs can only read WEBJS_PUBLIC_* variables and NODE_ENV. Any other read leaks the server value into the server-rendered HTML and is undefined after hydration. NEXT_PUBLIC_ is Next.js's prefix and means nothing here.
Fix: rename a browser-facing variable to WEBJS_PUBLIC_ (NEXT_PUBLIC_MAPS_KEY becomes WEBJS_PUBLIC_MAPS_KEY) in your .env files and the code. Read a secret in a page function, server action or middleware and pass a derived value to the component. Page, layout and boundary functions run on the server only and are not flagged. See Configuration.
Code behind process.env.NEXT_RUNTIME never runs (no-next-runtime-guard)
Symptom: an instrumentation register() wrapped in if (process.env.NEXT_RUNTIME === 'nodejs') never starts your APM, and webjs check reports no-next-runtime-guard.
Cause: only Next.js sets NEXT_RUNTIME. Under WebJs it is undefined, so the guarded branch never runs.
Fix: drop the guard. WebJs runs instrumentation.ts register() once, on the server only. To tell Node from Bun, read process.versions.bun.
request.nextUrl throws in dev (no-next-url)
Symptom: middleware or a route handler written the Next.js way reads request.nextUrl.pathname or request.nextUrl.searchParams, and in dev the request fails with an error naming new URL(request.url).
Cause: nextUrl is Next.js's extended URL on its NextRequest. WebJs passes middleware and route handlers the platform Request, which has no such property, so dev refuses it loudly rather than let it read as undefined.
Fix: use new URL(request.url), whose pathname and searchParams are what nextUrl offered. The no-next-url check rule flags it at edit time. See Middleware.
Every request answers 500: the root middleware failed to load
Symptom: every request answers 500 naming the root middleware failed to load (and the dev overlay shows the cause), production readiness stays 503, or one subtree answers 500 naming its middleware.ts.
Cause: a middleware or proxy file has a syntax error, exports no function (WebJs accepts the default export, a named middleware, or a named proxy), or declares a config.matcher that is not a valid path pattern. Middleware is usually a guard, so WebJs fails closed: it never lets requests through unguarded. A middleware.ts and a proxy.ts side by side is refused the same way.
Fix: correct the file the message names, or keep only one of middleware.ts and proxy.ts. Reading request.nextUrl also throws in development: middleware receives the platform Request, so use new URL(request.url). See Middleware.
A /public/... url 404s, or the server refuses to start naming no-public-route-conflict
Symptom: an asset at /public/logo.png answers 404; or webjs start exits with [no-public-route-conflict] and webjs check reports the same rule.
Cause: files in public/ are served at the url ROOT, as in Next.js: public/logo.png is /logo.png, and there is no /public/ prefix. Because they are served before routes, a public file at the same url as a static page, a route.ts or a metadata route (public/robots.txt beside app/robots.ts) would hide one of them, so it is refused. A dynamic route is not a conflict: the public file simply wins for its one url.
Fix: drop /public from the url (<img src="/logo.png">, asset('/app.css')), and rename or move one side of a conflict. See Routing.
A page, layout or boundary does something that never happens in the browser
Symptom: a component defined in a page renders its markup but never reacts; a @click handler in a page never runs; a component fails to load with a 404 for a page file it imports; a component fails to load importing node:fs; or a page marked 'use client' does nothing interactive. webjs check names one of no-component-in-use-server-file, no-interactivity-in-server-component, no-server-component-in-client-template, no-use-client-in-route-module, no-component-in-route-module, no-event-binding-in-route-module, no-route-module-import-in-browser-module or no-node-builtin-in-browser-module.
Cause: pages, layouts and boundaries run only on the server, like Next.js server components, and never load in a browser. The client boot imports the components a route module renders instead of the module itself, so anything in the route module that needs a browser does nothing there: a component class defined in it is never registered on the client, an event binding on its template is dropped (Next.js refuses an event handler in a server component for the same reason), and a component importing it gets a 404 because route modules are never served. A Node builtin is the mirror case: it is fine in a page, and can never resolve in a component. A 'use client' directive, the Next.js way to make a page a client component, does nothing in a route module: in WebJs the client part of a page is a component. A component in a *.server.ts file is the server-only kind (the file must not start with 'use server', which would turn the class into an action): it renders on the server and is never defined in the browser, so interactivity in it never runs, and a client component rendering its tag gets an empty element after a re-render (pass it in as a child from the page instead). See Server-only components.
Fix: keep interactive code in a component in its own file (components/my-widget.ts) and render its tag from the page. Use <form action=${importedAction}> or a plain <a href> for something that should work without JavaScript. Move code shared by a page and a component into a helper under lib/. Do Node work in the page and pass the result in as a property, or behind a 'use server' action. For app-wide browser code with no component, use instrumentation-client.ts. webjs status and webjs doctor warn (ROUTE_BROWSER_CODE) about code in one that looks meant for the browser.
The page did a full reload after an edit
Symptom: you saved a file under webjs dev and the tab reloaded, losing component state, where you expected an in-place update.
Cause: the edit needed a reload. Most edits apply in place (a page or layout refresh, a component hot swap, a stylesheet swap), but a few cannot: a change to a component's constructor, a #private member, a changed property declaration, a new or deleted file, or a restart file such as .env.
Fix: read the browser console after the reload. Every full reload prints [webjs] full reload: <reason> (<file>) once the new page loads, naming the rule and the file that forced it. See Runtime for what each kind of edit does and Components for what a hot swap keeps.
An edit seems to do nothing in dev
Symptom: you save a file, the dev server logs the change, but the browser keeps showing the old code.
Cause: usually a service worker left over from running the app with npm run start on the same port, serving cached modules. Under webjs dev, /sw.js answers with a worker that clears every cache and unregisters itself, so the first load after starting the dev server removes it and the console logs [webjs] the service worker is off under webjs dev.
Fix: reload the tab once. If the edit still does not show, check the dev server's output for a rebuild error and the browser console for a full reload line. Test offline behaviour with npm run start.
The dev server says the file watch limit is reached
Symptom: webjs dev prints [webjs] the file watch limit is reached (ENOSPC), so <dir>/ is watched by polling every 1s. (or EMFILE), and edits in that directory land a second or so later than usual.
Cause: the operating system ran out of file watches (on Linux, the inotify limit, which a large node_modules or several editors can use up). Rather than going deaf, the dev server watches the directory that hit the limit by polling it once a second.
Fix: raise the limit with sudo sysctl fs.inotify.max_user_watches=524288, persist it in a file under /etc/sysctl.d/, and restart the dev server.
Still stuck
The framework source is in node_modules/@webjsdev/ with no build step, so what you read is what runs. Grep the relevant file (the SSR pipeline in @webjsdev/server/src/ssr.js, client hydration in @webjsdev/core/src/render-client.js, the convention rules in @webjsdev/server/src/check.js). Run webjs check to surface most of the issues above before they reach the browser, and run webjs check --rules to read what each rule enforces.