SvelteKit "Cannot prerender pages with actions" in CI
Prerendering produces static HTML at build time, but form actions run on the server per request. A route cannot be both static and have server actions, so SvelteKit fails the build when both are present.
What this error means
svelte-kit build fails with "Cannot prerender pages with actions" naming a +page.server.js route that exports actions while prerendering is enabled for it.
> Cannot prerender pages with actions
at /src/routes/contact/+page.server.jsCommon causes
A prerendered route exports form actions
The route sets prerender = true (or inherits it) yet defines actions, which require a live server, so the two conflict.
A global prerender default catches an interactive page
A root layout sets prerender = true for the whole app, sweeping in a page that genuinely needs server actions.
How to fix it
Disable prerendering for the action route
Mark the interactive route as not prerendered so its actions run on the server.
// src/routes/contact/+page.server.js
export const prerender = false;Scope the prerender default more narrowly
If a layout enables prerendering globally, override it on routes that need actions instead of disabling it everywhere.
// keep static pages prerendered, opt this one out
export const prerender = false;How to prevent it
- Set
prerender = falseon any route with form actions. - Apply global prerender defaults carefully in layouts.
- Keep static content and interactive forms in separate routes where possible.