sveltejs/kit · error · Error

Could not find entry point

Error message

Could not find entry point

What it means

When generating the static Vercel config, adapter-vercel locates the immutable entry chunk (a file starting with 'start.') inside the built client output to attach a version-detection cookie header. If the build output directory contains no such file, the build cannot proceed correctly and throws.

Source

Thrown at packages/adapter-vercel/index.js:495

					key: 'Sec-Fetch-Dest',
					value: 'document'
				}
			],
			headers: {
				'Set-Cookie': `__vdpl=${process.env.VERCEL_DEPLOYMENT_ID}; Path=${builder.config.paths.base}/; SameSite=Strict; Secure; HttpOnly`
			},
			continue: true
		});

		// this is a dreadful hack that is necessary until the Vercel Build Output API
		// allows you to set multiple cookies for a single route. essentially, since we
		// know that the entry file will be requested immediately, we can set the second
		// cookie in _that_ response rather than the document response
		const base = `${dir}/${builder.config.appDir}/immutable/entry`;
		const entry = fs.readdirSync(base).find((file) => file.startsWith('start.'));

		if (!entry) {
			throw new Error('Could not find entry point');
		}

		routes.splice(-2, 0, {
			src: `/${builder.getAppPath()}/immutable/entry/${entry}`,
			headers: {
				'Set-Cookie': `__vdpl=; Path=/${builder.getAppPath()}/version.json; SameSite=Strict; Secure; HttpOnly`
			},
			continue: true
		});
	}

	routes.push({
		handle: 'filesystem'
	});

	// Prevent incorrect caching: if a request to /_app/immutable/* doesn't match
	// a static file, return 404 instead of falling through to dynamic routes.
	// Otherwise, we could accidentally immutably cache dynamic content served

View on GitHub (pinned to 03f1687fe6)

Solutions

  1. Clean rebuild: delete .svelte-kit/output (or node_modules/.vite) and run `vite build` again
  2. Check for Vite/Rollup config that changes chunk file naming (output.entryFileNames) and revert it
  3. Ensure no plugin strips or renames files under the immutable/entry directory
  4. Verify the client build actually completed (look for .svelte-kit/output/client/_app/immutable/entry/start.*.js on disk)

Example fix

// before: custom naming in vite.config
build: { rollupOptions: { output: { entryFileNames: 'app-[name].js' } } }
// after: remove custom entryFileNames so 'start.*' chunk name is preserved
build: {}
Defensive patterns

Strategy: fallback

Validate before calling

import { existsSync, readdirSync } from 'fs';
const base = '.svelte-kit/output/client/_app/immutable/entry';
const ok = existsSync(base) && readdirSync(base).some((f) => f.startsWith('start.'));
if (!ok) throw new Error('client entry chunk missing — rebuild before adapting');

Type guard

const hasEntryChunk = (base) =>
  existsSync(base) && readdirSync(base).some((f) => f.startsWith('start.'));

Try / catch

try {
  await adapt();
} catch (err) {
  if (err.message === 'Could not find entry point') {
    console.error('Rebuild the client output; check Vite/Rollup naming plugins.');
  }
  throw err;
}

Prevention

When it happens

Trigger: fs.readdirSync over `${dir}/${appDir}/immutable/entry` finds no file beginning with 'start.' during static_vercel_config.

Common situations: Corrupted or partial build output; a build tool/config change (e.g. custom output dir, chunk naming plugins, Vite rollupOptions altering entry file names) renamed the entry chunk; running the adapter against a stale `.svelte-kit` directory.

Related errors


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