sveltejs/kit · error · Error

The SvelteKit Vite plugin ${keypath} should be an object wit

Error message

The SvelteKit Vite plugin ${keypath} should be an object with an `adapt` method. See https://svelte.dev/docs/kit/adapters

What it means

`kit.adapter` must be an adapter object exposing an `adapt` method — i.e. the result of calling an adapter package like @sveltejs/adapter-node or adapter-auto. The validator throws when the value is not such an object, most often because the adapter package was not actually invoked or is missing.

Source

Thrown at packages/kit/src/core/config/options.js:49

	'trusted-types': string_array(),
	'upgrade-insecure-requests': boolean(false),
	'require-sri-for': string_array(),
	'block-all-mixed-content': boolean(false),
	'plugin-types': string_array(),
	referrer: string_array()
});

const prerender_handler = validate(undefined, (input, keypath) => {
	if (typeof input === 'function') return input;
	if (['fail', 'warn', 'ignore'].includes(input)) return input;
	throw new Error(`${keypath} should be "fail", "warn", "ignore" or a custom function`);
});

const options = {
	adapter: validate(undefined, (input, keypath) => {
		if (typeof input !== 'object' || !input.adapt) {
			const message = `The SvelteKit Vite plugin ${keypath} should be an object with an \`adapt\` method`;
			throw new Error(`${message}. See https://svelte.dev/docs/kit/adapters`);
		}

		return input;
	}),

	alias: deprecate(
		validate({}, (input, keypath) => {
			if (typeof input !== 'object') {
				throw new Error(`${keypath} should be an object`);
			}

			for (const key in input) {
				assert_string(input[key], `${keypath}.${key}`);
			}

			return input;
		}),
		(keypath) =>

View on GitHub (pinned to 03f1687fe6)

Solutions

  1. Call the adapter factory and pass the result: `adapter: adapter({ ...options })`.
  2. Ensure the adapter package is installed (`pnpm i -D @sveltejs/adapter-node`) and imported correctly (`import adapter from '@sveltejs/adapter-node'`).
  3. Remove any string/placeholder values and use a real adapter object.

Example fix

// before
import adapter from '@sveltejs/adapter-node';
kit: { adapter }
// after
import adapter from '@sveltejs/adapter-node';
kit: { adapter: adapter() }
Defensive patterns

Strategy: type-guard

Validate before calling

import adapter from '@sveltejs/adapter-node';
const a = adapter();
if (typeof a !== 'object' || typeof a.adapt !== 'function') {
  throw new Error('kit.adapter must be the result of calling an adapter factory');
}

Type guard

/** @returns {boolean} */
function isAdapter(v) {
  return typeof v === 'object' && v !== null && typeof v.adapt === 'function';
}

Try / catch

try {
  await viteBuild();
} catch (e) {
  if (e.message.includes("should be an object with an `adapt` method")) {
    console.error('Call the adapter factory: adapter: adapter()');
  }
  throw e;
}

Prevention

When it happens

Trigger: validate_options processes config.kit.adapter and finds typeof input !== 'object' or input.adapt is falsy: e.g. `adapter: adapterNode` (the module, not the call result), `adapter: '@sveltejs/adapter-node'` (a string), or an adapter package not installed.

Common situations: Forgetting to call the adapter factory (`adapter: adapter` instead of `adapter: adapter()`); assigning the package name as a string; importing the wrong export from an adapter package; adapter not in package.json dependencies.

Related errors


AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02). Data as JSON: /api/errors/5d6ae7f5e4ec40a7. Report an issue: GitHub.