{"record":{"id":"8a01fc1c25213fd6","repo":"remotion-dev/remotion","slug":"config-setkeyboardshortcuts-expects-an-object","errorCode":null,"errorMessage":"Config.setKeyboardShortcuts() expects an object.","messagePattern":"Config\\.setKeyboardShortcuts\\(\\) expects an object\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/config/keyboard-shortcuts.ts","lineNumber":11,"sourceCode":"import {\n\ttype StudioKeyboardShortcuts,\n\tvalidateStudioKeyboardShortcuts,\n} from '@remotion/studio-shared';\n\nlet keyboardShortcuts: StudioKeyboardShortcuts | null = null;\n\nexport const setKeyboardShortcuts = (value: StudioKeyboardShortcuts) => {\n\tconst error = validateStudioKeyboardShortcuts(value);\n\tif (error !== null) {\n\t\tthrow new Error(error);\n\t}\n\n\tkeyboardShortcuts = value;\n};\n\nexport const getKeyboardShortcuts = () => keyboardShortcuts;\n\nexport const resetKeyboardShortcuts = () => {\n\tkeyboardShortcuts = null;\n};\n","sourceCodeStart":1,"sourceCodeEnd":22,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/cli/src/config/keyboard-shortcuts.ts#L1-L22","documentation":"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.).","triggerScenarios":"Calling Config.setKeyboardShortcuts(null), Config.setKeyboardShortcuts('ctrl+k'), or otherwise passing a non-object (or object of the wrong shape) in remotion.config.ts.","commonSituations":"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.","solutions":["Pass a plain object matching StudioKeyboardShortcuts, e.g. Config.setKeyboardShortcuts({toggleTimeline: 't'})","Check remotion.config.ts for accidental null/undefined/string values from variables","Run tsc on the config file to surface type mismatches at authoring time"],"exampleFix":"// before\nConfig.setKeyboardShortcuts(null);\n// after\nConfig.setKeyboardShortcuts({toggleTimeline: 't'});","handlingStrategy":"validation","validationCode":"const isValidShortcuts = (v: unknown) =>\n\ttypeof v === 'object' && v !== null && !Array.isArray(v);\nif (!isValidShortcuts(value)) throw new Error('setKeyboardShortcuts expects an object');","typeGuard":"const isStudioKeyboardShortcuts = (v: unknown): v is StudioKeyboardShortcuts =>\n\ttypeof v === 'object' && v !== null && !Array.isArray(v);","tryCatchPattern":"try {\n\tConfig.setKeyboardShortcuts(value);\n} catch (err) {\n\tconsole.warn('Invalid keyboard shortcuts config, using defaults:', (err as Error).message);\n}","preventionTips":["Use a TypeScript remotion.config.ts so type errors surface immediately","Never pass null/undefined variables into Config setters","Copy config examples verbatim and adjust values, not structure"],"tags":["config","validation","typescript"],"backgroundTag":"invalid-config-value","analyzedSha":"b2f4e34732f3c6c222ea029413e22dc402218cd7","analyzedAt":"2026-09-09T13:27:51.281Z","contentChangedAt":"2026-09-09T13:27:51.281Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}