sveltejs/kit · error · Error

Cannot use `read` from `$app/server` in ${route_id} when usi

Error message

Cannot use `read` from `$app/server` in ${route_id} when using ${adapter.name}. Please ensure that your adapter is up to date and supports this feature.

What it means

`read` from `$app/server` lets load functions and endpoints read assets (e.g. import.json files or content collections) from the deployment. Because reading files is platform-specific, each adapter must declare `supports.read`. If the configured adapter doesn't claim support for the route, Kit throws this error at build/dev analysis time.

Source

Thrown at packages/kit/src/utils/features.js:18

/**
 * @param {string} route_id
 * @param {Record<string, any>} config
 * @param {string} feature
 * @param {import('@sveltejs/kit').Adapter | undefined} adapter
 */
export function check_feature(route_id, config, feature, adapter) {
	if (!adapter) return;

	switch (feature) {
		case '$app/server:read': {
			const supported = adapter.supports?.read?.({
				route: { id: route_id },
				config
			});

			if (!supported) {
				throw new Error(
					`Cannot use \`read\` from \`$app/server\` in ${route_id} when using ${adapter.name}. Please ensure that your adapter is up to date and supports this feature.`
				);
			}
		}
	}
}

View on GitHub (pinned to 03f1687fe6)

Solutions

  1. Upgrade the adapter to the latest version that supports `read` (pnpm update @sveltejs/adapter-*)
  2. If on adapter-static, remove `read` usage or switch to an adapter that supports it (e.g. adapter-node)
  3. Ensure only one adapter version is installed (check pnpm why / lockfile for duplicates)
  4. If the adapter genuinely supports it but still fails, file an issue with adapter version and route id

Example fix

// before
"devDependencies": { "@sveltejs/adapter-node": "2.0.0" }
// after
"devDependencies": { "@sveltejs/adapter-node": "^5.2.0" }
Defensive patterns

Strategy: validation

Validate before calling

// before using read, verify adapter support
import { read } from '$app/server';
// check svelte.config.js: the chosen adapter must declare supports.read

Type guard

const adapterSupportsRead = (adapter) => typeof adapter?.supports?.read === 'function' || adapter?.supports?.read === true;

Try / catch

// Thrown at build/analysis time; guard at config level instead.
// In CI:
const config = require('./svelte.config.js');
if (usesRead && !adapterSupportsRead(config.kit.adapter)) {
  throw new Error('Adapter does not support read — upgrade or switch adapters');
}

Prevention

When it happens

Trigger: Using `read` in a +page.server.js/+layout.server.js/+server.js while the project's adapter either predates `supports.read` or explicitly returns false for the route (e.g. a static adapter or an outdated adapter version).

Common situations: Projects using adapter-static where `read` can't work; adapters not yet updated for the `read` feature; pnpm/monorepo setups resolving an old adapter copy; new Kit feature used with a pinned old adapter.

Related errors


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