SeleniumHQ/selenium · error · Error

Params must be an instance of ContinueRequestParameters. Rec

Error message

Params must be an instance of ContinueRequestParameters. Received:'${params}'

What it means

Thrown by Network.continueRequest() when params is not an instance of ContinueRequestParameters. The method calls params.asMap() to form the network.continueRequest BiDi command, so it strictly requires that class. A raw object or a different Parameters class fails the instanceof guard before serialization.

Source

Thrown at javascript/selenium-webdriver/bidi/network.js:312

      method: 'network.continueWithAuth',
      params: {
        request: requestId.toString(),
        action: 'cancel',
      },
    }
    await this.bidi.send(command)
  }

  /**
   * Continues the network request with the provided parameters.
   *
   * @param {ContinueRequestParameters} params - The parameters for continuing the request.
   * @throws {Error} If params is not an instance of ContinueRequestParameters.
   * @returns {Promise<void>} A promise that resolves when the command is sent.
   */
  async continueRequest(params) {
    if (!(params instanceof ContinueRequestParameters)) {
      throw new Error(`Params must be an instance of ContinueRequestParameters. Received:'${params}'`)
    }

    const command = {
      method: 'network.continueRequest',
      params: Object.fromEntries(params.asMap()),
    }

    await this.bidi.send(command)
  }

  /**
   * Continues the network response with the given parameters.
   *
   * @param {ContinueResponseParameters} params - The parameters for continuing the response.
   * @throws {Error} If params is not an instance of ContinueResponseParameters.
   * @returns {Promise<void>} A promise that resolves when the command is sent.
   */
  async continueResponse(params) {

View on GitHub (pinned to aa36b38e69)

Solutions

  1. Build a ContinueRequestParameters instance, set the request id and any overrides, then call continueRequest(params): new ContinueRequestParameters(requestId).body(...)...
  2. Always pass the Parameters object, never the bare request id string.
  3. Check that the class you instantiate is ContinueRequestParameters (continueRequest) and not ContinueResponseParameters (continueResponse).

Example fix

// before
await network.continueRequest(event.request.request) // raw object/string

// after
const params = new ContinueRequestParameters(event.request.request)
  .method('GET')
await network.continueRequest(params)
Defensive patterns

Strategy: type-guard

Validate before calling

if (!(params instanceof ContinueRequestParameters)) {
  throw new TypeError('continueRequest requires ContinueRequestParameters')
}

Type guard

function isContinueRequestParameters(v) {
  return v instanceof ContinueRequestParameters
}

Try / catch

try {
  await network.continueRequest(params)
} catch (e) {
  if (/instance of ContinueRequestParameters/.test(e.message)) {
    // wrap the request id in ContinueRequestParameters
  } else throw e
}

Prevention

When it happens

Trigger: Calling network.continueRequest({...}) with a literal object; passing a request id string directly instead of wrapping it in ContinueRequestParameters; passing a ProvideResponseParameters or ContinueResponseParameters object by mistake.

Common situations: Intercepting a beforeRequestSent event and calling continueRequest with the raw event/request object instead of building the parameters object; reusing a parameter builder from the wrong response method.

Related errors


AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14). Data as JSON: /api/errors/976a7c4c785d53f5. Report an issue: GitHub.