Errors

ERR_OUT_OF_RANGE

A numeric input falls outside the supported range. Check units, bounds and whether the operation expects an integer. Tested on Node.js 22.16.0. Example output (one line per entry): ["ERR_OUT_OF_RANGE", "65535"].

Formal Syntax & Structure

nodejs syntaxnodejs
error.code === "ERR_OUT_OF_RANGE"

Return Value

Error

Observed error classification; successful correction has its own return value.

Working Example

Example Snippetnodejs
const b = Buffer.alloc(2);try {    b.writeUInt16BE(65536);}catch (e) {    console.log(e.code);}b.writeUInt16BE(65535);console.log(b.readUInt16BE());
Node.js Reference