{"record":{"id":"042d44e93d0e858d","repo":"remotion-dev/remotion","slug":"config-addelementlibrary-expects-an-absolute-url","errorCode":null,"errorMessage":"Config.addElementLibrary() expects an absolute URL, got ${JSON.stringify(url)}","messagePattern":"Config\\.addElementLibrary\\(\\) expects an absolute URL, got (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/config/element-libraries.ts","lineNumber":33,"sourceCode":"\t) {\n\t\tconst receivedType = Array.isArray(options) ? 'an array' : typeof options;\n\t\tthrow new Error(\n\t\t\t`Config.addElementLibrary() expects an object, got ${receivedType}`,\n\t\t);\n\t}\n\n\tconst {url, displayName} = options;\n\tif (typeof url !== 'string') {\n\t\tthrow new Error(\n\t\t\t`Config.addElementLibrary() expects \"url\" to be a string, got ${typeof url}`,\n\t\t);\n\t}\n\n\tlet parsedUrl: URL;\n\ttry {\n\t\tparsedUrl = new URL(url);\n\t} catch {\n\t\tthrow new Error(\n\t\t\t`Config.addElementLibrary() expects an absolute URL, got ${JSON.stringify(url)}`,\n\t\t);\n\t}\n\n\tif (parsedUrl.protocol !== 'http:' && parsedUrl.protocol !== 'https:') {\n\t\tthrow new Error(\n\t\t\t`Config.addElementLibrary() only supports HTTP and HTTPS URLs, got ${JSON.stringify(url)}`,\n\t\t);\n\t}\n\n\tif (displayName !== undefined && typeof displayName !== 'string') {\n\t\tthrow new Error(\n\t\t\t`Config.addElementLibrary() expects the display name to be a string, got ${typeof displayName}`,\n\t\t);\n\t}\n\n\tconst trimmedDisplayName = displayName?.trim() ?? null;\n\tif (trimmedDisplayName === '') {","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/remotion-dev/remotion/blob/8f9775815716e25b2a9fd9c5511015a17624243d/packages/cli/src/config/element-libraries.ts#L15-L51","documentation":"The url option must be an absolute URL parseable by the URL constructor. Relative paths or malformed strings (missing scheme, stray characters) fail parsing and throw.","triggerScenarios":"Passing 'example.com/library.json', '/library.json', or a string with invalid URL characters to Config.addElementLibrary().","commonSituations":"Using a relative path instead of https://..., or a template string that produced undefined/empty segments.","solutions":["Prefix the URL with the scheme, e.g. https://example.com/library.json","Log the url value right before the call to spot malformed template output"],"exampleFix":"// before\nConfig.addElementLibrary({url: 'example.com/library.json'});\n\n// after\nConfig.addElementLibrary({url: 'https://example.com/library.json'});","handlingStrategy":"validation","validationCode":"try { new URL(url); } catch { /* not absolute; prepend scheme */ }","typeGuard":"const isAbsoluteUrl = (u: string) => { try { new URL(u); return true; } catch { return false; } };","tryCatchPattern":null,"preventionTips":["Always use fully-qualified https URLs in config","Test config parsing in a unit test"],"tags":["config","element-library","url","validation"],"backgroundTag":"invalid-url-format","analyzedSha":"8f9775815716e25b2a9fd9c5511015a17624243d","analyzedAt":"2026-08-28T15:39:09.316Z","contentChangedAt":"2026-08-28T15:39:09.316Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}