sveltejs/kit · error

When using named actions, the default action cannot be used.

Error message

When using named actions, the default action cannot be used. See the docs for more info: https://svelte.dev/docs/kit/form-actions#named-actions

What it means

Form-action configuration check run before handling an action request: the +page.server.js actions object mixes a `default` action with named actions. With named actions present, the default action cannot be addressed (the ?/x query param selects named ones), so the combination is rejected to prevent unreachable code.

Source

Thrown at packages/kit/src/runtime/server/page/actions.js:209

				location,
				// @ts-expect-error this will be removed upon serialization, so `undefined` is the same as omission
				data
			};
		}
	} catch (e) {
		return action_error_result(
			e instanceof ActionFailure ? new Error('Cannot "throw fail()". Use "return fail()"') : e,
			location
		);
	}
}

/**
 * @param {Actions} actions
 */
function check_named_default_separate(actions) {
	if (actions.default && Object.keys(actions).length > 1) {
		throw new Error(
			'When using named actions, the default action cannot be used. See the docs for more info: https://svelte.dev/docs/kit/form-actions#named-actions'
		);
	}
}

/**
 * @param {RequestEvent} event
 * @param {import('types').RequestState} state
 * @param {NonNullable<ServerNode['actions']>} actions
 * @throws {Redirect | HttpError | SvelteKitError | Error}
 */
async function call_action(event, state, actions) {
	const url = new URL(event.request.url);

	let name = 'default';
	for (const param of url.searchParams) {
		if (param[0].startsWith('/')) {
			name = param[0].slice(1);

View on GitHub (pinned to 03f1687fe6)

Solutions

  1. Remove the `default` action and give every action a name, invoking them via ?/action-name
  2. Drop the named actions and keep only `default` if a single action suffices
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/kit/src/runtime/server/page/actions.js:209 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/f04e3618ad184a13. Report an issue: GitHub.