sveltejs/kit · error · DOMException

AbortError

AbortError

Error message

The operation was aborted.

What it means

Internal server fetch guard: before forking state and issuing the subrequest, internal_fetch checks the request's AbortSignal; if it is already aborted it throws a DOMException with name 'AbortError' and this standard message. Mirrors native fetch abort semantics for server-side subrequests so callers can treat cancellation uniformly.

Source

Thrown at packages/kit/src/runtime/server/fetch.js:200

 * @param {RequestInit | undefined} init
 * @param {URL} url
 */
function normalize_fetch_input(info, init, url) {
	if (info instanceof Request) {
		return info;
	}

	return new Request(typeof info === 'string' ? new URL(info, url) : info, init);
}

/**
 * @param {Request} request
 * @param {import('types').RequestState} state
 * @returns {Promise<Response>}
 */
async function internal_fetch(request, state) {
	if (request.signal?.aborted) {
		throw new DOMException('The operation was aborted.', 'AbortError');
	}

	const subrequest_state = fork_state_for_subrequest(state);

	if (!request.signal) {
		return await respond(request, subrequest_state);
	}

	let remove_abort_listener = noop;
	/** @type {Promise<never>} */
	const abort_promise = new Promise((_, reject) => {
		const on_abort = () => {
			reject(new DOMException('The operation was aborted.', 'AbortError'));
		};
		request.signal.addEventListener('abort', on_abort, { once: true });
		remove_abort_listener = () => request.signal.removeEventListener('abort', on_abort);
	});

View on GitHub (pinned to 03f1687fe6)

Solutions

  1. Check request.signal?.aborted before issuing the internal fetch
  2. Catch the AbortError DOMException in the caller and skip/cancel dependent work
  3. Avoid aborting the parent request before subrequests complete
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at packages/kit/src/runtime/server/fetch.js:200 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/d4493d123530ebe2. Report an issue: GitHub.