SeleniumHQ/selenium · error · Error
Status must be an integer. Received:'${statusCode}'
Error message
Status must be an integer. Received:'${statusCode}' What it means
Thrown by `ContinueResponseParameters.statusCode()` when the argument is not an integer (`!Number.isInteger(statusCode)`). This rejects floats, strings, NaN, and booleans; the value must be a whole number. Note `Number.isInteger` is stricter than a truthy/numeric check.
Source
Thrown at javascript/selenium-webdriver/bidi/continueResponseParameters.js:117
*/
reasonPhrase(reasonPhrase) {
if (typeof reasonPhrase !== 'string') {
throw new Error(`Reason phrase must be a string. Received: '${reasonPhrase})'`)
}
this.#map.set('reasonPhrase', reasonPhrase)
return this
}
/**
* Sets the status code for the response.
*
* @param {number} statusCode - The status code to set.
* @returns {ContinueResponseParameters} - The current instance of the ContinueResponseParameters for chaining.
* @throws {Error} - If the `statusCode` parameter is not an integer.
*/
statusCode(statusCode) {
if (!Number.isInteger(statusCode)) {
throw new Error(`Status must be an integer. Received:'${statusCode}'`)
}
this.#map.set('statusCode', statusCode)
return this
}
asMap() {
return this.#map
}
}
module.exports = { ContinueResponseParameters }
View on GitHub (pinned to aa36b38e69)
Solutions
- Pass a plain integer literal like 200, 404, 500
- If the value arrives as a string, convert with `Number.parseInt(code, 10)` and re-validate with `Number.isInteger` before calling
Example fix
// before
params.statusCode('200')
// after
params.statusCode(200) Defensive patterns
Strategy: validation
Validate before calling
if (Number.isInteger(code)) params.statusCode(code)
Type guard
const isStatusCode = (c) => Number.isInteger(c)
Prevention
- Use integer literals, never strings, for status codes
- Parse string sources with Number.parseInt and re-validate with Number.isInteger
When it happens
Trigger: Calling `params.statusCode('200')` (string), `params.statusCode(200.5)` (float), `params.statusCode(undefined)`, or `params.statusCode(true)`.
Common situations: Status code read as a string from config/headers; floating-point math producing a non-integer; passing a Boolean.
Related errors
- Value must be an instance of BytesValue. Received: '${value}
- CookieHeader must be an instance of Header. Received:'${head
- Header value must be an instance of Header. Received:'${head
- Http method must be a string. Received: '${method})'
- Url must be a string. Received:'${url}'
AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14).
Data as JSON: /api/errors/10ce277e4d19ee39.
Report an issue: GitHub.