remotion-dev/remotion · error

Config.setKeyboardShortcuts() expects an object.

Error message

Config.setKeyboardShortcuts() expects an object.

What it means

Config.setKeyboardShortcuts() validates its argument with validateStudioKeyboardShortcuts before storing it. When validation fails, the returned message (here 'Config.setKeyboardShortcuts() expects an object.') is thrown. It fires when the remotion.config file passes something other than a valid keyboard-shortcuts object (null, a string, an array, etc.).

Source

Thrown at packages/cli/src/config/keyboard-shortcuts.ts:11

import {
	type StudioKeyboardShortcuts,
	validateStudioKeyboardShortcuts,
} from '@remotion/studio-shared';

let keyboardShortcuts: StudioKeyboardShortcuts | null = null;

export const setKeyboardShortcuts = (value: StudioKeyboardShortcuts) => {
	const error = validateStudioKeyboardShortcuts(value);
	if (error !== null) {
		throw new Error(error);
	}

	keyboardShortcuts = value;
};

export const getKeyboardShortcuts = () => keyboardShortcuts;

export const resetKeyboardShortcuts = () => {
	keyboardShortcuts = null;
};

View on GitHub (pinned to b2f4e34732)

Solutions

  1. Pass a plain object matching StudioKeyboardShortcuts, e.g. Config.setKeyboardShortcuts({toggleTimeline: 't'})
  2. Check remotion.config.ts for accidental null/undefined/string values from variables
  3. Run tsc on the config file to surface type mismatches at authoring time

Example fix

// before
Config.setKeyboardShortcuts(null);
// after
Config.setKeyboardShortcuts({toggleTimeline: 't'});
Defensive patterns

Strategy: validation

Validate before calling

const isValidShortcuts = (v: unknown) =>
	typeof v === 'object' && v !== null && !Array.isArray(v);
if (!isValidShortcuts(value)) throw new Error('setKeyboardShortcuts expects an object');

Type guard

const isStudioKeyboardShortcuts = (v: unknown): v is StudioKeyboardShortcuts =>
	typeof v === 'object' && v !== null && !Array.isArray(v);

Try / catch

try {
	Config.setKeyboardShortcuts(value);
} catch (err) {
	console.warn('Invalid keyboard shortcuts config, using defaults:', (err as Error).message);
}

Prevention

When it happens

Trigger: Calling Config.setKeyboardShortcuts(null), Config.setKeyboardShortcuts('ctrl+k'), or otherwise passing a non-object (or object of the wrong shape) in remotion.config.ts.

Common situations: Copy-pasting config snippets incorrectly; programmatically building the config value and accidentally passing undefined; type errors hidden because the config file is JavaScript, not TypeScript.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of remotion-dev/remotion@b2f4e34732 (2026-09-09). Data as JSON: /api/errors/8a01fc1c25213fd6. Report an issue: GitHub.