appsmithorg/appsmith · error · ImportError
The script at ${url} cannot be installed.
Error message
The script at ${url} cannot be installed. What it means
Thrown as ImportError(url) inside installLibrary (the singular/classic install path) when both fallbacks fail: self.importScripts(url) threw, and the subsequent dynamic import(/* webpackIgnore: true */ url) also threw. The library URL could be loaded neither as a classic script nor as an ES module, so it is reported as uninstallable. The message is 'The script at ${url} cannot be installed.'
Source
Thrown at app/client/src/workers/Evaluation/handlers/jsLibrary.ts:216
log.debug(e, `importScripts failed for ${url}`);
try {
// If importScripts fails, try to import the library using dynamic import
module = await import(/* webpackIgnore: true */ url);
// If the module is not an object, it is not a valid ESM library
if (module && typeof module === "object") {
const uniqAccessor = generateUniqueAccessor(
url,
takenAccessors,
takenNamesMap,
);
self[uniqAccessor] = flattenModule(module);
accessors.push(uniqAccessor);
}
} catch (e) {
log.debug(e, `dynamic import failed for ${url}`);
throw new ImportError(url);
}
}
// If no accessors at this point, installation likely failed.
if (accessors.length === 0) {
throw new Error("Unable to determine a unique accessor");
}
// Name of the library is the last accessor. This is totally random and needs fixing.
const name = accessors[accessors.length - 1];
defs["!name"] = `LIB/${name}`;
try {
for (const key of accessors) {
defs[key] = makeTernDefs(self[key]);
}
} catch (e) {
for (const acc of accessors) {View on GitHub (pinned to 8cd9021c24)
Solutions
- Open the URL in a browser/incognito and confirm it returns raw JavaScript (not HTML) with HTTP 200.
- Switch to a reliable CDN form, e.g. the jsDelivr ESM URL https://cdn.jsdelivr.net/npm/<pkg>@<version>/+esm, or a UMD build for importScripts.
- Verify the host permits cross-origin script loading (CORS / Access-Control-Allow-Origin: *).
- Check network/proxy/DNS from the Appsmith server/pod; the fetch happens in the evaluation worker.
- Try a pinned version (@x.y.z) instead of @latest to avoid a deleted/renamed tag.
Example fix
// before (importable URL invalid) https://example.com/lib.min.js // returns HTML 404 page // after https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js
Defensive patterns
Strategy: validation
Validate before calling
// Validate a URL before handing it to the library installer
function isValidLibUrl(raw) {
let u;
try { u = new URL(raw); } catch { return false; }
if (u.protocol !== 'https:' && u.protocol !== 'http:') return false;
return /\.(js|mjs)$/i.test(u.pathname) || u.pathname.includes('+esm');
}
// usage: only install when isValidLibUrl(url) is true Type guard
const isInstallableUrl = (raw) => {
try {
const u = new URL(raw, location.href);
return (u.protocol === 'https:' || u.protocol === 'http:')
&& /\.(js|mjs)$/i.test(u.pathname);
} catch { return false; }
}; Try / catch
// The installer surfaces this as a failed install result; handle it in the UI:
try {
await installLibrary(url);
} catch (e) {
if (e?.name === 'ImportError') {
showToast(`Could not install ${url}. Check the URL, CORS, and network.`);
} else throw e;
} Prevention
- Open the URL in a browser first; confirm it returns raw JS with HTTP 200.
- Prefer jsDelivr (+esm) or a UMD bundle from a versioned CDN path.
- Confirm the host sends Access-Control-Allow-Origin: *.
- Pin a specific version (@x.y.z) rather than @latest.
- Verify server/pod egress to the CDN host is allowed by proxy/firewall.
When it happens
Trigger: Adding an external JS library URL in the Appsmith library installer that 404s, is not valid JavaScript, is blocked by CORS for both importScripts and dynamic import, returns HTML (e.g. a CDN error page), or is a non-module file that importScripts cannot parse. Network offline / DNS failure during install also lands here.
Common situations: Using a raw GitHub URL instead of a CDN URL; pointing at a /src/ file rather than a built bundle; CDN returns a 5xx; corporate proxy blocks the host; the URL serves ESM-only content but the worker's importScripts path fails and the dynamic-import fallback also errors.
Related errors
- Unable to determine a unique accessor
- Failed to generate autocomplete definitions for ${name}.
- Unable to generate a unique accessor
- Failed to load JS libraries
- ${extractExecutionErrorMessage(e)}
AI-assisted analysis of appsmithorg/appsmith@8cd9021c24 (2026-08-12).
Data as JSON: /api/errors/32868f9949539756.
Report an issue: GitHub.