remotion-dev/remotion · error · Error

Config.addElementLibrary() expects "url" to be a string, got

Error message

Config.addElementLibrary() expects "url" to be a string, got ${typeof url}

What it means

addElementLibrary requires a url string in the options object. If url is missing or not a string, the setter throws reporting typeof url.

Source

Thrown at packages/cli/src/config/element-libraries.ts:24

};

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)}`,
		);
	}

	if (parsedUrl.protocol !== 'http:' && parsedUrl.protocol !== 'https:') {
		throw new Error(
			`Config.addElementLibrary() only supports HTTP and HTTPS URLs, got ${JSON.stringify(url)}`,
		);
	}

View on GitHub (pinned to 8f97758157)

Solutions

  1. Add a url: string property with the library's absolute URL
  2. Check for typos in the property name and that any env var used resolves to a string

Example fix

// before
Config.addElementLibrary({displayName: 'X'});

// after
Config.addElementLibrary({url: 'https://example.com/library.json', displayName: 'X'});
Defensive patterns

Strategy: type-guard

Validate before calling

if (typeof options.url !== 'string') { /* fix before calling Config */ }

Type guard

const hasStringUrl = (o: unknown): o is {url: string} => typeof o === 'object' && o !== null && typeof (o as {url?: unknown}).url === 'string';

Prevention

When it happens

Trigger: Calling Config.addElementLibrary({displayName: 'X'}) without url, or with url as a number/object/undefined.

Common situations: Typos in the options key (e.g. href or URL), or reading the URL from an env variable that is undefined.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of remotion-dev/remotion@8f97758157 (2026-08-28). Data as JSON: /api/errors/6e138adc23f68e75. Report an issue: GitHub.