sveltejs/kit · error · Error

incorrect_fail_message (form action returned an ActionFailur

Error message

incorrect_fail_message (form action returned an ActionFailure during validation, dev-only)

What it means

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.

Source

Thrown at packages/kit/src/runtime/app/server/remote/form.js:133

					const issue = create_issues();

					try {
						output.result = await run_remote_function(
							event,
							state,
							true,
							() => data,
							(data) => (!maybe_fn ? fn() : fn(data, issue))
						);

						if (DEV && output.result instanceof ActionFailure) {
							throw new Error(incorrect_fail_message);
						}
					} catch (e) {
						if (e instanceof ValidationError) {
							handle_issues(output, e.issues, form_data, __.id);
						} else if (DEV && e instanceof ActionFailure) {
							throw new Error(incorrect_fail_message, { cause: e });
						} else {
							throw e;
						}
					}
				}

				// We don't need to care about args or deduplicating calls, because uneval results are only relevant in full page reloads
				// where only one form submission is active at the same time
				if (!event.isRemoteRequest) {
					const cache = get_cache(__, state);
					cache[''] ??= output;

					// register under the client-side action id so the output is serialized
					// into the page, allowing the hydrated client to restore `result`/`issues`/`input`
					get_implicit_lookup(__, state)[__.key ? `${__.id}/${__.key}` : __.id] = () => cache[''];
				}

				return output;

View on GitHub (pinned to 03f1687fe6)

Solutions

  1. Do not throw fail() inside a remote form function; use the issue callback for validation failures
  2. Return plain data and let the form machinery handle invalid-state reporting
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/kit/src/runtime/app/server/remote/form.js:133 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/6dfa17f77fbceb7f. Report an issue: GitHub.