{"record":{"id":"8bdee8a51497d1ca","repo":"remotion-dev/remotion","slug":"could-not-resolve-dependency-name","errorCode":null,"errorMessage":"Could not resolve ${dependency.name}","messagePattern":"Could not resolve (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/browser-studio/src/BrowserStudio.tsx","lineNumber":300,"sourceCode":"\t\t\t\tconst requestedVersion = dependency.name.startsWith('@remotion/')\n\t\t\t\t\t? remotionVersion\n\t\t\t\t\t: dependency.version;\n\t\t\t\tconst customResolution = dependencyResolverRef.current?.({\n\t\t\t\t\tname: dependency.name,\n\t\t\t\t\tversion: requestedVersion,\n\t\t\t\t});\n\t\t\t\tconst customVersion =\n\t\t\t\t\ttypeof customResolution === 'string' &&\n\t\t\t\t\t!customResolution.startsWith('http')\n\t\t\t\t\t\t? customResolution\n\t\t\t\t\t\t: typeof customResolution === 'object'\n\t\t\t\t\t\t\t? (customResolution?.version ?? null)\n\t\t\t\t\t\t\t: null;\n\t\t\t\tconst version = dependency.name.startsWith('@remotion/')\n\t\t\t\t\t? remotionVersion\n\t\t\t\t\t: (customVersion ?? requestedVersion);\n\t\t\t\tif (version === null) {\n\t\t\t\t\tthrow new Error(`Could not resolve ${dependency.name}`);\n\t\t\t\t}\n\n\t\t\t\tversions[dependency.name] = version;\n\t\t\t\tresolutions[dependency.name] = dependency.name.startsWith('@remotion/')\n\t\t\t\t\t? typeof customResolution === 'string' &&\n\t\t\t\t\t\tcustomResolution.startsWith('http')\n\t\t\t\t\t\t? customResolution\n\t\t\t\t\t\t: typeof customResolution === 'object' && customResolution?.url\n\t\t\t\t\t\t\t? {url: customResolution.url}\n\t\t\t\t\t\t\t: version\n\t\t\t\t\t: (customResolution ?? version);\n\t\t\t}\n\n\t\t\tinstalledDependencyResolutionsRef.current = {\n\t\t\t\t...installedDependencyResolutionsRef.current,\n\t\t\t\t...resolutions,\n\t\t\t};\n\t\t\treturn Promise.resolve(versions);","sourceCodeStart":282,"sourceCodeEnd":318,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/browser-studio/src/BrowserStudio.tsx#L282-L318","documentation":"After the Remotion version is fixed, each non-@remotion dependency must still resolve to a concrete version string. The requested version comes from dependency.version, optionally overridden by the dependencyResolver prop; if the resolver is absent, returns null, returns an http(s) URL string, or returns an object without a .version field, version stays null and this error is thrown naming the package.","triggerScenarios":"installPackages({dependencies: [{name: 'lodash', version: null}]}) with no dependencyResolver prop, or with a resolver that returns null / a URL string / {url} without version for that package.","commonSituations":"Remotion Element payloads that declare third-party dependencies without versions; hosts that only implement dependencyResolver for @remotion/* packages; resolver implementations that map everything to CDN URLs (URL strings are treated as resolutions, not versions, for non-Remotion packages).","solutions":["Pass a concrete version string in each dependency entry: {name: 'lodash', version: '4.17.21'}.","Implement the dependencyResolver prop to return {version: '...'} (or a URL string) for every non-@remotion dependency you support.","Filter out optional dependencies with version null before calling installPackages."],"exampleFix":"// before\ninstallPackages({dependencies: [{name: 'lodash', version: null}]});\n\n// after\ninstallPackages({dependencies: [{name: 'lodash', version: '4.17.21'}]});\n// or on the host:\n<BrowserStudio dependencyResolver={({name}) => registry.lookup(name)} />","handlingStrategy":"validation","validationCode":"const hasResolvableVersion = (\n  dependency: {name: string; version: string | null},\n  resolver: BrowserStudioDependencyResolver | undefined,\n): boolean => {\n  if (dependency.name.startsWith('@remotion/')) return true; // pinned internally\n  if (dependency.version !== null) return true;\n  const resolution = resolver?.({name: dependency.name, version: null});\n  if (typeof resolution === 'string') return true; // treated as URL\n  if (resolution && typeof resolution === 'object') {\n    return resolution.version !== undefined || resolution.url !== undefined;\n  }\n  return false;\n};\n\nconst installable = dependencies.filter((d) =>\n  hasResolvableVersion(d, dependencyResolver),\n);","typeGuard":null,"tryCatchPattern":"try {\n  await operations.packageInstallation.installPackages({dependencies});\n} catch (error) {\n  if (error instanceof Error && error.message.startsWith('Could not resolve ')) {\n    const missing = dependencies.find((d) => d.version === null);\n    // prompt the user for a version for `missing.name`, then retry\n  }\n}","preventionTips":["Never emit {name, version: null} entries for third-party packages.","Implement dependencyResolver to return a version or URL for every non-@remotion package you allow.","Reject dependency names not in your allowlist before calling install APIs."],"tags":["dependency-resolution","npm","dependency-resolver"],"backgroundTag":"unresolved-dependency-version","analyzedSha":"b2f4e34732f3c6c222ea029413e22dc402218cd7","analyzedAt":"2026-08-22T21:45:17.748Z","contentChangedAt":"2026-08-22T21:45:17.748Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}