{"record":{"id":"2acf92401d888831","repo":"SeleniumHQ/selenium","slug":"params-must-be-an-instance-of-provideresponseparam","errorCode":null,"errorMessage":"Params must be an instance of ProvideResponseParameters. Received:'${params}'","messagePattern":"Params must be an instance of ProvideResponseParameters\\. Received:'(.+?)'","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"javascript/selenium-webdriver/bidi/network.js","lineNumber":352,"sourceCode":"\n    const command = {\n      method: 'network.continueResponse',\n      params: Object.fromEntries(params.asMap()),\n    }\n\n    await this.bidi.send(command)\n  }\n\n  /**\n   * Provides a response for the network.\n   *\n   * @param {ProvideResponseParameters} params - The parameters for providing the response.\n   * @throws {Error} If params is not an instance of ProvideResponseParameters.\n   * @returns {Promise<void>} A promise that resolves when the command is sent.\n   */\n  async provideResponse(params) {\n    if (!(params instanceof ProvideResponseParameters)) {\n      throw new Error(`Params must be an instance of ProvideResponseParameters. Received:'${params}'`)\n    }\n\n    const command = {\n      method: 'network.provideResponse',\n      params: Object.fromEntries(params.asMap()),\n    }\n\n    await this.bidi.send(command)\n  }\n\n  /**\n   * Sets the cache behavior for network requests.\n   *\n   * @param {string} behavior - The cache behavior (\"default\" or \"bypass\")\n   * @param {Array<string>} [contexts] - Optional array of browsing context IDs\n   * @returns {Promise<void>} A promise that resolves when the cache behavior is set\n   * @throws {Error} If behavior is invalid or context IDs are invalid\n   */","sourceCodeStart":334,"sourceCodeEnd":370,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/javascript/selenium-webdriver/bidi/network.js#L334-L370","documentation":"Thrown by Network.provideResponse() when params is not an instance of ProvideResponseParameters. The method calls params.asMap() to build the network.provideResponse BiDi command and therefore requires that exact class. Plain objects or mismatched Parameters classes are rejected by the instanceof guard.","triggerScenarios":"Calling network.provideResponse({...}) with a literal object; passing the network id string directly; passing a ContinueResponseParameters instance by mistake.","commonSituations":"Mocking/providing a full response and passing a hand-built object instead of the typed builder; confusing provideResponse (full synthetic response) with continueResponse (forward with overrides).","solutions":["Build a ProvideResponseParameters instance, configure statusCode/reasonPhrase/headers/body/cookies, then call provideResponse(params).","Pass the Parameters instance, never a raw object or id.","Confirm the class name matches the method: ProvideResponseParameters for provideResponse."],"exampleFix":"// before\nawait network.provideResponse({ request: id, statusCode: 200 })\n\n// after\nconst params = new ProvideResponseParameters(id)\n  .statusCode(200)\n  .reasonPhrase('OK')\nawait network.provideResponse(params)","handlingStrategy":"type-guard","validationCode":"if (!(params instanceof ProvideResponseParameters)) {\n  throw new TypeError('provideResponse requires ProvideResponseParameters')\n}","typeGuard":"function isProvideResponseParameters(v) {\n  return v instanceof ProvideResponseParameters\n}","tryCatchPattern":"try {\n  await network.provideResponse(params)\n} catch (e) {\n  if (/instance of ProvideResponseParameters/.test(e.message)) {\n    // rebuild as ProvideResponseParameters\n  } else throw e\n}","preventionTips":["Use ProvideResponseParameters (full synthetic response), not ContinueResponseParameters.","Construct the builder with the network id and configure all fields before sending.","Keep parameter builders typed so editors warn on plain objects."],"tags":["bidi","network","intercept","provide-response","type-validation","javascript"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}