remotion-dev/remotion · error · Error
Config.addElementLibrary() only supports HTTP and HTTPS URLs
Error message
Config.addElementLibrary() only supports HTTP and HTTPS URLs, got ${JSON.stringify(url)} What it means
Even if the URL parses, addElementLibrary only accepts http: and https: protocols. Other schemes such as file:, data:, or ftp: are rejected.
Source
Thrown at packages/cli/src/config/element-libraries.ts:39
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)}`,
);
}
if (displayName !== undefined && typeof displayName !== 'string') {
throw new Error(
`Config.addElementLibrary() expects the display name to be a string, got ${typeof displayName}`,
);
}
const trimmedDisplayName = displayName?.trim() ?? null;
if (trimmedDisplayName === '') {
throw new Error(
'Config.addElementLibrary() expects the display name to not be empty',
);
}
elementLibraries.push({View on GitHub (pinned to 8f97758157)
Solutions
- Serve the library over http(s) (e.g. via a local static server) and use that URL
- For local development, use a localhost http URL rather than file://
Example fix
// before
Config.addElementLibrary({url: 'file:///libs/library.json'});
// after
// serve ./libs via: npx serve libs
Config.addElementLibrary({url: 'http://localhost:3000/library.json'}); Defensive patterns
Strategy: validation
Validate before calling
const proto = new URL(url).protocol;
if (proto !== 'http:' && proto !== 'https:') { /* serve over http instead */ } Type guard
const isHttpUrl = (u: string) => { try { const p = new URL(u).protocol; return p === 'http:' || p === 'https:'; } catch { return false; } }; Prevention
- Never use file:// or data: URLs for element libraries
- Run a local static server for development assets
When it happens
Trigger: Passing 'file:///Users/me/library.json' or 'data:application/json,...' as the url option.
Common situations: Pointing at a local file during development instead of serving it over HTTP, or pasting a data URL.
Related errors
- Config.addElementLibrary() expects an object, got ${received
- Config.addElementLibrary() expects "url" to be a string, got
- Config.addElementLibrary() expects an absolute URL, got ${JS
- 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/f2cdd4b9ead9a6a5.
Report an issue: GitHub.