sveltejs/kit · error · Error
Cannot call submit() on the server
Error message
Cannot call submit() on the server
What it means
Server-side stub on the remote form instance: submit() triggers an actual form POST from the browser. On the server there is no form element or request to send, so the method is replaced by this throwing stub whenever the form object is used during SSR or other server execution.
Source
Thrown at packages/kit/src/runtime/app/server/remote/form.js:235
Object.defineProperty(instance, 'submitted', {
get: () => false
});
Object.defineProperty(instance, 'preflight', {
// preflight is a noop on the server
value: () => instance
});
Object.defineProperty(instance, 'validate', {
value: () => {
throw new Error('Cannot call validate() on the server');
}
});
Object.defineProperty(instance, 'submit', {
value: () => {
throw new Error('Cannot call submit() on the server');
}
});
Object.defineProperty(instance, 'element', {
get: () => null
});
if (key == undefined) {
Object.defineProperty(instance, 'for', {
/** @type {RemoteForm<any, any>['for']} */
value: (key) => {
const { state } = get_request_store();
const cache_key = __.id + '|' + JSON.stringify(key);
/** @type {RemoteForm<Input, Output> & { __: RemoteFormInternals }} */
let instance = (state.remote.forms ??= new Map()).get(cache_key);
if (!instance) {
instance = /** @type {RemoteForm<Input, Output> & { __: RemoteFormInternals }} */ (View on GitHub (pinned to 03f1687fe6)
Solutions
- Call submit() only from browser code such as a button click handler
- Use a browser-environment check before calling server-unavailable form methods
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/kit/src/runtime/app/server/remote/form.js:235 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02).
Data as JSON: /api/errors/7891a68136b93f3e.
Report an issue: GitHub.