{"record":{"id":"9deff29335ff636b","repo":"Kong/insomnia","slug":"invalid-url-url","errorCode":null,"errorMessage":"Invalid URL: ${url}","messagePattern":"Invalid URL: (.+?)","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/insomnia/src/templating/sandbox/sandbox-globals.ts","lineNumber":252,"sourceCode":"  '    USP.prototype.has = function (k) { return this.get(k) !== null; };',\n  '    USP.prototype[\"delete\"] = function (k) { k = String(k); for (var i = this._p.length - 1; i >= 0; i--) { if (this._p[i][0] === k) { this._p.splice(i, 1); } } };',\n  '    USP.prototype.forEach = function (cb, thisArg) { for (var i = 0; i < this._p.length; i++) { cb.call(thisArg, this._p[i][1], this._p[i][0], this); } };',\n  '    USP.prototype.sort = function () { this._p.sort(function (a, b) { return a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0; }); };',\n  '    USP.prototype.toString = function () {',\n  '      var parts = []; for (var i = 0; i < this._p.length; i++) { parts.push(__enc(this._p[i][0]) + \"=\" + __enc(this._p[i][1])); } return parts.join(\"&\");',\n  '    };',\n  '    globalThis.URLSearchParams = USP;',\n  '  }',\n\n  // --- URL (pragmatic absolute-URL parser covering the common WHATWG surface) ---\n  // Parses scheme://[host[:port]][/path][?query][#hash]. Sufficient for the \"new URL(str).<part>\"\n  // and \".searchParams\" usage plugins rely on; relative-URL resolution is out of scope for M2.\n  '  if (typeof globalThis.URL === \"undefined\") {',\n  '    var __defaultPorts = { \"http:\": \"80\", \"https:\": \"443\", \"ftp:\": \"21\", \"ws:\": \"80\", \"wss:\": \"443\" };',\n  '    var URLShim = function (input, base) {',\n  '      var url = String(input);',\n  '      var m = /^([a-zA-Z][a-zA-Z0-9+.-]*:)(\\\\/\\\\/)?([^\\\\/?#]*)([^?#]*)(\\\\?[^#]*)?(#.*)?$/.exec(url);',\n  '      if (!m) { throw new TypeError(\"Invalid URL: \" + url); }',\n  '      this.protocol = m[1].toLowerCase();',\n  '      var authority = m[3] || \"\";',\n  '      var at = authority.lastIndexOf(\"@\");',\n  '      if (at !== -1) {',\n  '        var creds = authority.slice(0, at); authority = authority.slice(at + 1);',\n  '        var ci = creds.indexOf(\":\");',\n  '        this.username = ci === -1 ? creds : creds.slice(0, ci);',\n  '        this.password = ci === -1 ? \"\" : creds.slice(ci + 1);',\n  '      } else { this.username = \"\"; this.password = \"\"; }',\n  '      var colon = authority.indexOf(\":\");',\n  '      if (colon === -1) { this.hostname = authority.toLowerCase(); this.port = \"\"; }',\n  '      else { this.hostname = authority.slice(0, colon).toLowerCase(); this.port = authority.slice(colon + 1); }',\n  '      if (this.port !== \"\" && __defaultPorts[this.protocol] === this.port) { this.port = \"\"; }',\n  '      this.host = this.port === \"\" ? this.hostname : this.hostname + \":\" + this.port;',\n  '      this.pathname = m[4] || (authority ? \"/\" : \"\");',\n  '      this.search = m[5] || \"\";',\n  '      this.hash = m[6] || \"\";',\n  '      this.searchParams = new globalThis.URLSearchParams(this.search);',","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/Kong/insomnia/blob/d9bb2b0142600f21309832daea3317942d285984/packages/insomnia/src/templating/sandbox/sandbox-globals.ts#L234-L270","documentation":"Error \"Invalid URL: ${url}\" thrown in Kong/insomnia.","triggerScenarios":"Thrown at packages/insomnia/src/templating/sandbox/sandbox-globals.ts:252 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d9bb2b0142600f21309832daea3317942d285984","analyzedAt":"2026-08-26T18:04:05.187Z","schemaVersion":2},"datasetVersion":"2026-08-26T21:11:00.512Z"}