{"record":{"id":"10ce277e4d19ee39","repo":"SeleniumHQ/selenium","slug":"status-must-be-an-integer-received-statuscode","errorCode":null,"errorMessage":"Status must be an integer. Received:'${statusCode}'","messagePattern":"Status must be an integer\\. Received:'(.+?)'","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"javascript/selenium-webdriver/bidi/continueResponseParameters.js","lineNumber":117,"sourceCode":"   */\n  reasonPhrase(reasonPhrase) {\n    if (typeof reasonPhrase !== 'string') {\n      throw new Error(`Reason phrase must be a string. Received: '${reasonPhrase})'`)\n    }\n    this.#map.set('reasonPhrase', reasonPhrase)\n    return this\n  }\n\n  /**\n   * Sets the status code for the response.\n   *\n   * @param {number} statusCode - The status code to set.\n   * @returns {ContinueResponseParameters} - The current instance of the ContinueResponseParameters for chaining.\n   * @throws {Error} - If the `statusCode` parameter is not an integer.\n   */\n  statusCode(statusCode) {\n    if (!Number.isInteger(statusCode)) {\n      throw new Error(`Status must be an integer. Received:'${statusCode}'`)\n    }\n\n    this.#map.set('statusCode', statusCode)\n    return this\n  }\n\n  asMap() {\n    return this.#map\n  }\n}\n\nmodule.exports = { ContinueResponseParameters }\n","sourceCodeStart":99,"sourceCodeEnd":130,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/javascript/selenium-webdriver/bidi/continueResponseParameters.js#L99-L130","documentation":"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.","triggerScenarios":"Calling `params.statusCode('200')` (string), `params.statusCode(200.5)` (float), `params.statusCode(undefined)`, or `params.statusCode(true)`.","commonSituations":"Status code read as a string from config/headers; floating-point math producing a non-integer; passing a Boolean.","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"],"exampleFix":"// before\nparams.statusCode('200')\n// after\nparams.statusCode(200)","handlingStrategy":"validation","validationCode":"if (Number.isInteger(code)) params.statusCode(code)","typeGuard":"const isStatusCode = (c) => Number.isInteger(c)","tryCatchPattern":null,"preventionTips":["Use integer literals, never strings, for status codes","Parse string sources with Number.parseInt and re-validate with Number.isInteger"],"tags":["bidi","network-interception","validation","integer","status-code"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}