{"record":{"id":"834e34510d419ce9","repo":"remotion-dev/remotion","slug":"config-addelementlibrary-expects-the-display-nam","errorCode":null,"errorMessage":"Config.addElementLibrary() expects the display name to be a string, got ${typeof displayName}","messagePattern":"Config\\.addElementLibrary\\(\\) expects the display name to be a string, got (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/config/element-libraries.ts","lineNumber":45,"sourceCode":"\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 === '') {\n\t\tthrow new Error(\n\t\t\t'Config.addElementLibrary() expects the display name to not be empty',\n\t\t);\n\t}\n\n\telementLibraries.push({\n\t\tdisplayName: trimmedDisplayName,\n\t\turl: parsedUrl.href,\n\t});\n};\n\nexport const getElementLibraries = (): readonly StudioElementLibrary[] =>","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/remotion-dev/remotion/blob/8f9775815716e25b2a9fd9c5511015a17624243d/packages/cli/src/config/element-libraries.ts#L27-L63","documentation":"The optional displayName option must be a string when provided. Passing a number, object, or other type throws with typeof displayName.","triggerScenarios":"Config.addElementLibrary({url, displayName: 42}) or displayName derived from a non-string value.","commonSituations":"Programmatically building options where displayName comes from untyped data (e.g. package.json metadata).","solutions":["Convert displayName to a string before passing, or omit it entirely","Type the options object against the documented signature"],"exampleFix":"// before\nConfig.addElementLibrary({url, displayName: 42});\n\n// after\nConfig.addElementLibrary({url, displayName: String(42)});","handlingStrategy":"type-guard","validationCode":"if (displayName !== undefined && typeof displayName !== 'string') { /* convert or omit */ }","typeGuard":"const isOptionalString = (v: unknown): v is string | undefined => v === undefined || typeof v === 'string';","tryCatchPattern":null,"preventionTips":["Coerce displayName with String() when sourced from untyped data"],"tags":["config","element-library","display-name","validation"],"backgroundTag":"config-argument-type-invalid","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"}