{"record":{"id":"a0c2b4fc16ad6e33","repo":"SeleniumHQ/selenium","slug":"params-must-be-a-value-in-samesite-received-sa","errorCode":null,"errorMessage":"Params must be a value in SameSite. Received:'${sameSite}'","messagePattern":"Params must be a value in SameSite\\. Received:'(.+?)'","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"javascript/selenium-webdriver/bidi/cookieFilter.js","lineNumber":117,"sourceCode":"   *\n   * @param {boolean} secure - Whether the cookie fetched should be secure only or not.\n   * @returns {CookieFilter} - The updated CookieFilter instance for chaining.\n   */\n  secure(secure) {\n    this.#map.set('secure', secure)\n    return this\n  }\n\n  /**\n   * Sets the SameSite attribute for the cookie.\n   *\n   * @param {SameSite} sameSite - The SameSite value to be set for the cookie.\n   * @returns {CookieFilter} - The updated CookieFilter instance for chaining.\n   * @throws {Error} - If the provided sameSite value is not an instance of SameSite.\n   */\n  sameSite(sameSite) {\n    if (!(sameSite instanceof SameSite)) {\n      throw new Error(`Params must be a value in SameSite. Received:'${sameSite}'`)\n    }\n    this.#map.set('sameSite', sameSite)\n    return this\n  }\n\n  /**\n   * Sets the expiry value.\n   *\n   * @param {number} expiry - The expiry value.\n   * @returns {CookieFilter} - The updated CookieFilter instance for chaining.\n   */\n  expiry(expiry) {\n    this.#map.set('expiry', expiry)\n    return this\n  }\n\n  asMap() {\n    return this.#map","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/javascript/selenium-webdriver/bidi/cookieFilter.js#L99-L135","documentation":"This message is the *intended* guard in `CookieFilter.sameSite()`, meant to reject values that are not members of the `SameSite` enum. However the guard is malformed: `SameSite` (imported from `networkTypes.js`) is a plain object enum (`{STRICT:'strict', LAX:'lax', NONE:'none', DEFAULT:'default', findByName(){...}}`), not a class/constructor. The expression `sameSite instanceof SameSite` therefore throws `TypeError: Right-hand side of 'instanceof' is not callable` before this message can ever fire — so every call to `.sameSite()` fails with that TypeError regardless of argument, and this error string is effectively unreachable dead code.","triggerScenarios":"Calling `filter.sameSite(SameSite.STRICT)` (or any value at all) — every call throws a TypeError from the `instanceof` check, not this Error message. The check should use `Object.values(SameSite).includes(sameSite)` or `SameSite.findByName()` instead of `instanceof`.","commonSituations":"Any developer who calls `.sameSite()` on a CookieFilter hits the TypeError immediately; this is a library bug, not a usage mistake. The `SameSite.findByName()` helper exists in the enum object but the guard does not use it.","solutions":["Do not call `.sameSite()` — it is optional in CookieFilter; omit it and filter on name/domain/path instead","Report the bug upstream; the guard should check `['strict','lax','none','default'].includes(sameSite)` rather than `instanceof SameSite`","As a local workaround, monkeypatch/patch the module to fix the check until a release fixes it"],"exampleFix":"// before (throws TypeError on any input)\nconst { SameSite } = require('selenium-webdriver/bidi/networkTypes')\nfilter.sameSite(SameSite.LAX)\n\n// after — omit sameSite (it is optional)\nfilter.name('session').domain('example.com')\n// if strictly needed, patch the module or upgrade once the bug is fixed","handlingStrategy":"validation","validationCode":"// sameSite() is broken (instanceof on a plain object throws TypeError).\n// Avoid calling it. If you must validate a value first:\nconst validSameSite = ['strict', 'lax', 'none', 'default']\nif (typeof v === 'string' && validSameSite.includes(v)) {\n  // do NOT call filter.sameSite() — it throws TypeError; patch or omit\n}","typeGuard":"const isSameSiteValue = (v) => ['strict', 'lax', 'none', 'default'].includes(v)","tryCatchPattern":"try {\n  filter.sameSite(value)\n} catch (e) {\n  // Catches the TypeError from the broken instanceof guard.\n  // Workaround: omit sameSite entirely (it is optional).\n}","preventionTips":["Avoid .sameSite() on CookieFilter until the library bug is fixed — it always throws TypeError","Validate SameSite values against the string enum, not via instanceof","sameSite filtering is optional; omit it and use name/domain/path filters"],"tags":["bidi","storage","validation","same-site","library-bug","enum","instanceof"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}