{"record":{"id":"247716e10175ef1a","repo":"sveltejs/kit","slug":"cannot-call-validate-on-the-server","errorCode":null,"errorMessage":"Cannot call validate() on the server","messagePattern":"Cannot call validate\\(\\) on the server","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/kit/src/runtime/app/server/remote/form.js","lineNumber":229,"sourceCode":"\t\t});\n\n\t\t// On the server, pending is always 0\n\t\tObject.defineProperty(instance, 'pending', {\n\t\t\tget: () => 0\n\t\t});\n\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();","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/runtime/app/server/remote/form.js#L211-L247","documentation":"Server-side stub on the remote form instance: validate() is a client-only method that runs pre-submit validation in the browser. When the form object is created on the server (e.g. during SSR), calling validate() is replaced by this throwing stub because there is no DOM form to validate.","triggerScenarios":"Thrown at packages/kit/src/runtime/app/server/remote/form.js:229 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call validate() only in browser-side code, e.g. inside an event handler after mount","Guard shared code with a browser environment check"],"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"}