{"record":{"id":"7891a68136b93f3e","repo":"sveltejs/kit","slug":"cannot-call-submit-on-the-server","errorCode":null,"errorMessage":"Cannot call submit() on the server","messagePattern":"Cannot call submit\\(\\) on the server","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/kit/src/runtime/app/server/remote/form.js","lineNumber":235,"sourceCode":"\n\t\tObject.defineProperty(instance, 'submitted', {\n\t\t\tget: () => false\n\t\t});\n\n\t\tObject.defineProperty(instance, 'preflight', {\n\t\t\t// preflight is a noop on the server\n\t\t\tvalue: () => instance\n\t\t});\n\n\t\tObject.defineProperty(instance, 'validate', {\n\t\t\tvalue: () => {\n\t\t\t\tthrow new Error('Cannot call validate() on the server');\n\t\t\t}\n\t\t});\n\n\t\tObject.defineProperty(instance, 'submit', {\n\t\t\tvalue: () => {\n\t\t\t\tthrow new Error('Cannot call submit() on the server');\n\t\t\t}\n\t\t});\n\n\t\tObject.defineProperty(instance, 'element', {\n\t\t\tget: () => null\n\t\t});\n\n\t\tif (key == undefined) {\n\t\t\tObject.defineProperty(instance, 'for', {\n\t\t\t\t/** @type {RemoteForm<any, any>['for']} */\n\t\t\t\tvalue: (key) => {\n\t\t\t\t\tconst { state } = get_request_store();\n\t\t\t\t\tconst cache_key = __.id + '|' + JSON.stringify(key);\n\t\t\t\t\t/** @type {RemoteForm<Input, Output> & { __: RemoteFormInternals }} */\n\t\t\t\t\tlet instance = (state.remote.forms ??= new Map()).get(cache_key);\n\n\t\t\t\t\tif (!instance) {\n\t\t\t\t\t\tinstance = /** @type {RemoteForm<Input, Output> & { __: RemoteFormInternals }} */ (","sourceCodeStart":217,"sourceCodeEnd":253,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/runtime/app/server/remote/form.js#L217-L253","documentation":"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.","triggerScenarios":"Thrown at packages/kit/src/runtime/app/server/remote/form.js:235 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call submit() only from browser code such as a button click handler","Use a browser-environment check before calling server-unavailable form methods"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}