remotion-dev/remotion · error · Error
Config.addElementLibrary() expects an object, got ${received
Error message
Config.addElementLibrary() expects an object, got ${receivedType} What it means
Config.addElementLibrary() validates its single options argument and requires a plain object. Passing an array, null, a string, or a primitive throws with the received type in the message.
Source
Thrown at packages/cli/src/config/element-libraries.ts:17
import type {StudioElementLibrary} from '@remotion/studio-shared';
export type AddElementLibraryOptions = {
readonly url: string;
readonly displayName?: string;
};
let elementLibraries: StudioElementLibrary[] = [];
export const addElementLibrary = (options: AddElementLibraryOptions) => {
if (
typeof options !== 'object' ||
options === null ||
Array.isArray(options)
) {
const receivedType = Array.isArray(options) ? 'an array' : typeof options;
throw new Error(
`Config.addElementLibrary() expects an object, got ${receivedType}`,
);
}
const {url, displayName} = options;
if (typeof url !== 'string') {
throw new Error(
`Config.addElementLibrary() expects "url" to be a string, got ${typeof url}`,
);
}
let parsedUrl: URL;
try {
parsedUrl = new URL(url);
} catch {
throw new Error(
`Config.addElementLibrary() expects an absolute URL, got ${JSON.stringify(url)}`,
);View on GitHub (pinned to 8f97758157)
Solutions
- Pass a single options object: Config.addElementLibrary({url: 'https://...', displayName: '...'})
- If adding multiple libraries, call addElementLibrary once per library
Example fix
// before
Config.addElementLibrary(['https://example.com/library.json']);
// after
Config.addElementLibrary({url: 'https://example.com/library.json', displayName: 'My Library'}); Defensive patterns
Strategy: validation
Validate before calling
if (typeof opts !== 'object' || opts === null || Array.isArray(opts)) { throw new TypeError('options object required'); } Type guard
const isElementLibraryOptions = (v: unknown): v is {url: string; displayName?: string} => typeof v === 'object' && v !== null && !Array.isArray(v) && typeof (v as any).url === 'string'; Prevention
- Type your remotion.config.ts against the documented signature
- Call once per library, always with an object literal
When it happens
Trigger: Calling Config.addElementLibrary(...) with no argument, an array, a string, or a non-object value in remotion.config.ts.
Common situations: Copy-pasting a docs example incorrectly, passing a list of libraries, or calling the setter before arguments are constructed.
Related errors
- Config.addElementLibrary() expects "url" to be a string, got
- Config.addElementLibrary() expects an absolute URL, got ${JS
- Config.addElementLibrary() only supports HTTP and HTTPS URLs
- Config.addElementLibrary() expects the display name to be a
- Config.addElementLibrary() expects the display name to not b
AI-assisted analysis of remotion-dev/remotion@8f97758157 (2026-08-28).
Data as JSON: /api/errors/bd6c8b0d0aac7b4c.
Report an issue: GitHub.