sveltejs/kit · warning
The form action returned a value, but it isn't available in
Error message
The form action returned a value, but it isn't available in `page.form`, because SSR is off. To handle the returned value in CSR, enhance your form with `use:enhance`. See https://svelte.dev/docs/kit/form-actions#progressive-enhancement-use-enhance
What it means
When SSR is disabled (`ssr = false` or `export const ssr = false`), the server renders no HTML, so a value returned by a form action cannot be placed into `page.form` in the initial response. SvelteKit warns that the action's return value is being lost and recommends using `use:enhance` so the result is delivered via the client-side fetch instead.
Source
Thrown at packages/kit/src/runtime/server/page/index.js:127
const csr = nodes.csr();
// renders an empty 'shell' page if SSR is turned off and if there is
// no server data to prerender. As a result, the load functions and rendering
// only occur client-side.
if (
ssr === false &&
!((state.prerendering || state.prerender_default === true) && should_prerender_data)
) {
// if the user makes a request through a non-enhanced form, the returned value is lost
// because there is no SSR or client-side handling of the response
if (DEV && action_result && !event.request.headers.has('x-sveltekit-action')) {
if (action_result.type === 'error') {
console.warn(
"The form action returned an error, but +error.svelte wasn't rendered because SSR is off. To get the error page with CSR, enhance your form with `use:enhance`. See https://svelte.dev/docs/kit/form-actions#progressive-enhancement-use-enhance"
);
} else if (action_result.data) {
/// case: lost data
console.warn(
"The form action returned a value, but it isn't available in `page.form`, because SSR is off. To handle the returned value in CSR, enhance your form with `use:enhance`. See https://svelte.dev/docs/kit/form-actions#progressive-enhancement-use-enhance"
);
}
}
return await render_response({
// provide nodes without running load functions so that the styles and
// fonts are linked in the head before CSR takes over
branch: compact(nodes.data).map((node) => {
return {
node,
data: null,
server_data: null
};
}),
fetched,
page_config: {
ssr: false,View on GitHub (pinned to 03f1687fe6)
Solutions
- Enhance the form with `use:enhance` from `$app/forms` so the action result reaches the client.
- Enable SSR for the page (`export const ssr = true` or remove the override) so `page.form` is hydrated server-side.
- Redesign the action to redirect on success instead of returning data if you must keep SSR off and no enhance.
Example fix
<!-- before -->
<form method="POST" action="?/create">...</form>
<!-- after -->
<script>
import { enhance } from '$app/forms';
</script>
<form method="POST" action="?/create" use:enhance>...</form> Defensive patterns
Strategy: fallback
Validate before calling
// client-side check before relying on page.form
if (!ssrEnabledForThisRoute && !formIsEnhanced) {
console.warn('action return value will be lost; use use:enhance or enable SSR');
} Prevention
- Always enhance forms with `use:enhance` when a page has `ssr = false`.
- Avoid returning data from actions on CSR-only pages; prefer redirects.
- Document per-route SSR settings so form handling matches the render mode.
When it happens
Trigger: A `<form method="POST">` posts to an action on a page with SSR off, the action returns `{ success: true, ... }` (non-error data), and the form is NOT enhanced with `use:enhance`; render_page detects `action_result.data` but cannot serialize it into the CSR-only render.
Common situations: Progressive-enhancement pages exported with `export const ssr = false` where developers expect `page.form` to be populated after a plain (non-JS-enhanced) form submission.
Related errors
- Cannot `return redirect(...)` — use `redirect(...)` instead
- Cannot `return error(...)` — use `error(...)` or `return fai
- Data returned from action inside ${route_id} is not serializ
- Data returned from action inside ${route_id} is not serializ
- Cannot prerender pages with actions
AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02).
Data as JSON: /api/errors/562273316f0d4e6f.
Report an issue: GitHub.