{"record":{"id":"6e138adc23f68e75","repo":"remotion-dev/remotion","slug":"config-addelementlibrary-expects-url-to-be-a-s","errorCode":null,"errorMessage":"Config.addElementLibrary() expects \"url\" to be a string, got ${typeof url}","messagePattern":"Config\\.addElementLibrary\\(\\) expects \"url\" to be a string, got (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/config/element-libraries.ts","lineNumber":24,"sourceCode":"};\n\nlet elementLibraries: StudioElementLibrary[] = [];\n\nexport const addElementLibrary = (options: AddElementLibraryOptions) => {\n\tif (\n\t\ttypeof options !== 'object' ||\n\t\toptions === null ||\n\t\tArray.isArray(options)\n\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}","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/remotion-dev/remotion/blob/8f9775815716e25b2a9fd9c5511015a17624243d/packages/cli/src/config/element-libraries.ts#L6-L42","documentation":"addElementLibrary requires a url string in the options object. If url is missing or not a string, the setter throws reporting typeof url.","triggerScenarios":"Calling Config.addElementLibrary({displayName: 'X'}) without url, or with url as a number/object/undefined.","commonSituations":"Typos in the options key (e.g. href or URL), or reading the URL from an env variable that is undefined.","solutions":["Add a url: string property with the library's absolute URL","Check for typos in the property name and that any env var used resolves to a string"],"exampleFix":"// before\nConfig.addElementLibrary({displayName: 'X'});\n\n// after\nConfig.addElementLibrary({url: 'https://example.com/library.json', displayName: 'X'});","handlingStrategy":"type-guard","validationCode":"if (typeof options.url !== 'string') { /* fix before calling Config */ }","typeGuard":"const hasStringUrl = (o: unknown): o is {url: string} => typeof o === 'object' && o !== null && typeof (o as {url?: unknown}).url === 'string';","tryCatchPattern":null,"preventionTips":["Double-check key names against the docs","Assert env-derived URLs are strings before use"],"tags":["config","element-library","url","validation"],"backgroundTag":"missing-required-argument","analyzedSha":"8f9775815716e25b2a9fd9c5511015a17624243d","analyzedAt":"2026-08-28T15:39:09.316Z","contentChangedAt":"2026-08-28T15:39:09.316Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}