{"record":{"id":"6dfa17f77fbceb7f","repo":"sveltejs/kit","slug":"incorrect-fail-message-form-action-returned-an-ac-6dfa17","errorCode":null,"errorMessage":"incorrect_fail_message (form action returned an ActionFailure during validation, dev-only)","messagePattern":"incorrect_fail_message \\(form action returned an ActionFailure during validation, dev-only\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/kit/src/runtime/app/server/remote/form.js","lineNumber":133,"sourceCode":"\t\t\t\t\tconst issue = create_issues();\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\toutput.result = await run_remote_function(\n\t\t\t\t\t\t\tevent,\n\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t() => data,\n\t\t\t\t\t\t\t(data) => (!maybe_fn ? fn() : fn(data, issue))\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tif (DEV && output.result instanceof ActionFailure) {\n\t\t\t\t\t\t\tthrow new Error(incorrect_fail_message);\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tif (e instanceof ValidationError) {\n\t\t\t\t\t\t\thandle_issues(output, e.issues, form_data, __.id);\n\t\t\t\t\t\t} else if (DEV && e instanceof ActionFailure) {\n\t\t\t\t\t\t\tthrow new Error(incorrect_fail_message, { cause: e });\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthrow e;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// We don't need to care about args or deduplicating calls, because uneval results are only relevant in full page reloads\n\t\t\t\t// where only one form submission is active at the same time\n\t\t\t\tif (!event.isRemoteRequest) {\n\t\t\t\t\tconst cache = get_cache(__, state);\n\t\t\t\t\tcache[''] ??= output;\n\n\t\t\t\t\t// register under the client-side action id so the output is serialized\n\t\t\t\t\t// into the page, allowing the hydrated client to restore `result`/`issues`/`input`\n\t\t\t\t\tget_implicit_lookup(__, state)[__.key ? `${__.id}/${__.key}` : __.id] = () => cache[''];\n\t\t\t\t}\n\n\t\t\t\treturn output;","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/kit/src/runtime/app/server/remote/form.js#L115-L151","documentation":"Dev-only diagnostic inside remote form handling: the error caught while running the remote form function was itself an ActionFailure (stored as the error's cause). This happens when the developer throws fail() inside a remote form function — remote forms use the issue callback instead of ActionFailure — so in dev the original error is rethrown with the explanatory incorrect_fail_message to point at the misuse.","triggerScenarios":"Thrown at packages/kit/src/runtime/app/server/remote/form.js:133 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Do not throw fail() inside a remote form function; use the issue callback for validation failures","Return plain data and let the form machinery handle invalid-state reporting"],"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"}