{"record":{"id":"32868f9949539756","repo":"appsmithorg/appsmith","slug":"the-script-at-url-cannot-be-installed","errorCode":null,"errorMessage":"The script at ${url} cannot be installed.","messagePattern":"The script at (.+?) cannot be installed\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"app/client/src/workers/Evaluation/handlers/jsLibrary.ts","lineNumber":216,"sourceCode":"      log.debug(e, `importScripts failed for ${url}`);\n      try {\n        // If importScripts fails, try to import the library using dynamic import\n        module = await import(/* webpackIgnore: true */ url);\n\n        // If the module is not an object, it is not a valid ESM library\n        if (module && typeof module === \"object\") {\n          const uniqAccessor = generateUniqueAccessor(\n            url,\n            takenAccessors,\n            takenNamesMap,\n          );\n\n          self[uniqAccessor] = flattenModule(module);\n          accessors.push(uniqAccessor);\n        }\n      } catch (e) {\n        log.debug(e, `dynamic import failed for ${url}`);\n        throw new ImportError(url);\n      }\n    }\n\n    // If no accessors at this point, installation likely failed.\n    if (accessors.length === 0) {\n      throw new Error(\"Unable to determine a unique accessor\");\n    }\n\n    // Name of the library is the last accessor. This is totally random and needs fixing.\n    const name = accessors[accessors.length - 1];\n\n    defs[\"!name\"] = `LIB/${name}`;\n    try {\n      for (const key of accessors) {\n        defs[key] = makeTernDefs(self[key]);\n      }\n    } catch (e) {\n      for (const acc of accessors) {","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/appsmithorg/appsmith/blob/8cd9021c24cdbea1c3c12c966073708e83db60c2/app/client/src/workers/Evaluation/handlers/jsLibrary.ts#L198-L234","documentation":"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.'","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (importable URL invalid)\nhttps://example.com/lib.min.js  // returns HTML 404 page\n\n// after\nhttps://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js","handlingStrategy":"validation","validationCode":"// Validate a URL before handing it to the library installer\nfunction isValidLibUrl(raw) {\n  let u;\n  try { u = new URL(raw); } catch { return false; }\n  if (u.protocol !== 'https:' && u.protocol !== 'http:') return false;\n  return /\\.(js|mjs)$/i.test(u.pathname) || u.pathname.includes('+esm');\n}\n// usage: only install when isValidLibUrl(url) is true","typeGuard":"const isInstallableUrl = (raw) => {\n  try {\n    const u = new URL(raw, location.href);\n    return (u.protocol === 'https:' || u.protocol === 'http:')\n      && /\\.(js|mjs)$/i.test(u.pathname);\n  } catch { return false; }\n};","tryCatchPattern":"// The installer surfaces this as a failed install result; handle it in the UI:\ntry {\n  await installLibrary(url);\n} catch (e) {\n  if (e?.name === 'ImportError') {\n    showToast(`Could not install ${url}. Check the URL, CORS, and network.`);\n  } else throw e;\n}","preventionTips":["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."],"tags":["js-library","evaluation","network","import","cdn"],"backgroundTag":null,"analyzedSha":"8cd9021c24cdbea1c3c12c966073708e83db60c2","analyzedAt":"2026-08-12T22:14:19.293Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}