{"record":{"id":"33b80c4b8238727c","repo":"SeleniumHQ/selenium","slug":"no-capabilities-provided-for-merge","errorCode":null,"errorMessage":"no capabilities provided for merge","messagePattern":"no capabilities provided for merge","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"warning","filePath":"javascript/selenium-webdriver/lib/capabilities.js","lineNumber":344,"sourceCode":"   *     set of capabilities to merge.\n   * @return {!Capabilities} A self reference.\n   */\n  merge(other) {\n    if (other) {\n      let otherMap\n      if (other instanceof Capabilities) {\n        otherMap = other.map_\n      } else if (other instanceof Map) {\n        otherMap = other\n      } else {\n        otherMap = toMap(other)\n      }\n      otherMap.forEach((value, key) => {\n        this.set(key, value)\n      })\n      return this\n    } else {\n      throw new TypeError('no capabilities provided for merge')\n    }\n  }\n\n  /**\n   * Deletes an entry from this set of capabilities.\n   *\n   * @param {string} key the capability key to delete.\n   */\n  delete(key) {\n    this.map_.delete(key)\n  }\n\n  /**\n   * @param {string} key The capability key.\n   * @param {*} value The capability value.\n   * @return {!Capabilities} A self reference.\n   * @throws {TypeError} If the `key` is not a string.\n   */","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/javascript/selenium-webdriver/lib/capabilities.js#L326-L362","documentation":"Thrown by Capabilities.merge() when the argument is falsy (null, undefined, 0, '', false). The method requires a non-null Capabilities, Map, or plain object to merge from. A falsy argument means nothing was provided to merge.","triggerScenarios":"Calling capabilities.merge(null), merge(undefined), or merging a variable that was conditionally assigned and not set. Chaining merges where an optional config object is absent.","commonSituations":"Optional capability sources not initialized; conditional merging where the source may be null; merging values from a lookup that returned nothing; default parameter not provided.","solutions":["Guard the merge call: if (other) caps.merge(other).","Default to an empty object: caps.merge(other || {}).","Initialize the variable to a Capabilities or empty object before merging.","Skip merging entirely if no additional capabilities are needed."],"exampleFix":"// before\ncaps.merge(maybeCaps) // maybeCaps is null\n// after\nif (maybeCaps) caps.merge(maybeCaps)","handlingStrategy":"validation","validationCode":"if (!other) {\n  // nothing to merge; skip or throw a clearer error\n  return caps\n}\ncaps.merge(other)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Guard merge calls with a truthiness check: if (other) caps.merge(other).","Initialize optional capability objects to an empty Capabilities or {} rather than null.","Use default parameters: function setup(caps, extra = {}) { caps.merge(extra) }."],"tags":["capabilities","validation","merge","configuration"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}