SeleniumHQ/selenium · error · Error
Params must be an instance of ProvideResponseParameters. Rec
Error message
Params must be an instance of ProvideResponseParameters. Received:'${params}' What it means
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.
Source
Thrown at javascript/selenium-webdriver/bidi/network.js:352
const command = {
method: 'network.continueResponse',
params: Object.fromEntries(params.asMap()),
}
await this.bidi.send(command)
}
/**
* Provides a response for the network.
*
* @param {ProvideResponseParameters} params - The parameters for providing the response.
* @throws {Error} If params is not an instance of ProvideResponseParameters.
* @returns {Promise<void>} A promise that resolves when the command is sent.
*/
async provideResponse(params) {
if (!(params instanceof ProvideResponseParameters)) {
throw new Error(`Params must be an instance of ProvideResponseParameters. Received:'${params}'`)
}
const command = {
method: 'network.provideResponse',
params: Object.fromEntries(params.asMap()),
}
await this.bidi.send(command)
}
/**
* Sets the cache behavior for network requests.
*
* @param {string} behavior - The cache behavior ("default" or "bypass")
* @param {Array<string>} [contexts] - Optional array of browsing context IDs
* @returns {Promise<void>} A promise that resolves when the cache behavior is set
* @throws {Error} If behavior is invalid or context IDs are invalid
*/View on GitHub (pinned to aa36b38e69)
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.
Example fix
// before
await network.provideResponse({ request: id, statusCode: 200 })
// after
const params = new ProvideResponseParameters(id)
.statusCode(200)
.reasonPhrase('OK')
await network.provideResponse(params) Defensive patterns
Strategy: type-guard
Validate before calling
if (!(params instanceof ProvideResponseParameters)) {
throw new TypeError('provideResponse requires ProvideResponseParameters')
} Type guard
function isProvideResponseParameters(v) {
return v instanceof ProvideResponseParameters
} Try / catch
try {
await network.provideResponse(params)
} catch (e) {
if (/instance of ProvideResponseParameters/.test(e.message)) {
// rebuild as ProvideResponseParameters
} else throw e
} Prevention
- 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.
When it happens
Trigger: Calling network.provideResponse({...}) with a literal object; passing the network id string directly; passing a ContinueResponseParameters instance by mistake.
Common situations: 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).
Related errors
- Params must be an instance of AddInterceptParameters. Receiv
- Params must be an instance of ContinueRequestParameters. Rec
- Params must be an instance of ContinueResponseParameters. Re
- Value must be an instance of BytesValue. Received: ${typeof
- CookieHeader must be an instance of Header. Received:'${head
AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14).
Data as JSON: /api/errors/2acf92401d888831.
Report an issue: GitHub.