remotion-dev/remotion · error · Error

Error in remotion.config.ts file

Error message

Error in remotion.config.ts file: ${result.errors
				.map((error) => error.text)
				.join('\n')}

What it means

Thrown by prepareConfigFile when esbuild reports one or more errors while bundling remotion.config.ts/js. The message joins all esbuild error.text values with newlines, surfacing syntax errors, unresolved imports, or type errors encountered during config bundling.

Solutions

  1. Read the joined error text in the message - it pinpoints the line/column in remotion.config.ts.
  2. Fix the syntax/import error and re-run.
  3. If an import cannot be resolved, install the package or remove the import.
  4. Run `npx tsc --noEmit remotion.config.ts` to get richer TS diagnostics.

Example fix

// before - remotion.config.ts
import { Config } from './wrong-path';
// after
import {Config} from '@remotion/cli/config';
Defensive patterns

Strategy: try-catch

Validate before calling

import {build} from 'esbuild';

const preflightConfig = async (entry: string) => {
  const result = await build({
    entryPoints: [entry],
    bundle: true,
    write: false,
    platform: 'node',
    logLevel: 'silent',
  });
  if (result.errors.length > 0) {
    throw new Error(`remotion.config.ts has errors:\n${result.errors.map(e => e.text).join('\n')}`);
  }
};

await preflightConfig(configPath);

Try / catch

try {
  await renderMedia(...);
} catch (err) {
  if (err instanceof Error && err.message.startsWith('Error in remotion.config.ts file:')) {
    // surface esbuild text, fix the config, then retry
  }
  throw err;
}

Prevention

When it happens

Trigger: A syntax error in remotion.config.ts; importing a module that does not exist or is not installed; referencing a Node builtin that esbuild cannot resolve under packages:'external'; TypeScript type errors that esbuild surfaces.

Common situations: Editing remotion.config.ts and introducing a typo; calling Config methods that do not exist; importing from a package not yet installed; switching Remotion versions where a Config API was renamed.

Related errors


AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12). Data as JSON: /api/errors/fd0b7f033418385c. Report an issue: GitHub.

Appendix: source

Thrown at packages/cli/src/load-config.ts:39

		throw new Error(
			`Could not find a tsconfig.json file in your project. Did you delete it? Create a tsconfig.json in the root of your project. Copy the default file from https://github.com/remotion-dev/template-helloworld/blob/main/tsconfig.json. The root directory is: ${remotionRoot}`,
		);
	}

	const virtualOutfile = 'bundle.js';
	const result = await BundlerInternals.esbuild.build({
		platform: 'node',
		target: 'node16',
		bundle: true,
		entryPoints: [resolved],
		tsconfig: isJavascript ? undefined : tsconfigJson,
		absWorkingDir: remotionRoot,
		outfile: virtualOutfile,
		write: false,
		packages: 'external',
	});
	if (result.errors.length > 0) {
		throw new Error(
			`Error in remotion.config.ts file: ${result.errors
				.map((error) => error.text)
				.join('\n')}`,
		);
	}

	const firstOutfile = result.outputFiles[0];

	if (!firstOutfile) {
		throw new Error('No output files found in the config file.');
	}

	const code = new TextDecoder().decode(firstOutfile.contents);
	return {code, remotionRoot, resolved};
};

export const executeConfigFile = ({code, remotionRoot}: PreparedConfigFile) => {
	let str = code;

View on GitHub (pinned to 78fe4bb3fd)