{"record":{"id":"e999e5b59d298e64","repo":"SeleniumHQ/selenium","slug":"url-must-be-a-string-received-url","errorCode":null,"errorMessage":"Url must be a string. Received:'${url}'","messagePattern":"Url must be a string\\. Received:'(.+?)'","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"javascript/selenium-webdriver/bidi/continueRequestParameters.js","lineNumber":110,"sourceCode":"   */\n  method(method) {\n    if (typeof method !== 'string') {\n      throw new Error(`Http method must be a string. Received: '${method})'`)\n    }\n    this.#map.set('method', method)\n    return this\n  }\n\n  /**\n   * Sets the URL for the request.\n   *\n   * @param {string} url - The URL to set for the request.\n   * @returns {ContinueRequestParameters} - The current instance of the ContinueRequestParameters for chaining.\n   * @throws {Error} - If the url parameter is not a string.\n   */\n  url(url) {\n    if (typeof url !== 'string') {\n      throw new Error(`Url must be a string. Received:'${url}'`)\n    }\n\n    this.#map.set('url', url)\n    return this\n  }\n\n  asMap() {\n    return this.#map\n  }\n}\n\nmodule.exports = { ContinueRequestParameters }\n","sourceCodeStart":92,"sourceCodeEnd":123,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/javascript/selenium-webdriver/bidi/continueRequestParameters.js#L92-L123","documentation":"Thrown by `ContinueRequestParameters.url()` when the argument is not a string (`typeof url !== 'string'`). The value is stored directly into the BiDi command map without coercion, so a `URL` object or `undefined` is rejected.","triggerScenarios":"Calling `params.url(new URL('https://...'))` (a URL object is not a string type), `params.url(null)`, or passing a parsed URL object from another library.","commonSituations":"Passing a `URL` object instead of `.href`/`.toString()`; undefined URL from optional config; reusing a WHATWG URL instance.","solutions":["Pass a plain string, calling `.href` or `.toString()` on any URL object first","Ensure the variable is a defined string"],"exampleFix":"// before\nparams.url(new URL('https://example.com'))\n// after\nparams.url('https://example.com')","handlingStrategy":"validation","validationCode":"if (typeof url === 'string') params.url(url)","typeGuard":"const isUrlString = (u) => typeof u === 'string'","tryCatchPattern":null,"preventionTips":["Coerce URL objects with .toString()/.href before passing","A typeof check guards against undefined from optional config"],"tags":["bidi","network-interception","validation","string","url"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}