1# Errors
2
3<!--introduced_in=v4.0.0-->
4<!--type=misc-->
5
6Applications running in Node.js will generally experience four categories of
7errors:
8
9- Standard JavaScript errors such as {EvalError}, {SyntaxError}, {RangeError},
10  {ReferenceError}, {TypeError}, and {URIError}.
11- System errors triggered by underlying operating system constraints such
12  as attempting to open a file that does not exist or attempting to send data
13  over a closed socket.
14- User-specified errors triggered by application code.
15- `AssertionError`s are a special class of error that can be triggered when
16  Node.js detects an exceptional logic violation that should never occur. These
17  are raised typically by the `assert` module.
18
19All JavaScript and System errors raised by Node.js inherit from, or are
20instances of, the standard JavaScript {Error} class and are guaranteed
21to provide *at least* the properties available on that class.
22
23## Error Propagation and Interception
24
25<!--type=misc-->
26
27Node.js supports several mechanisms for propagating and handling errors that
28occur while an application is running. How these errors are reported and
29handled depends entirely on the type of `Error` and the style of the API that is
30called.
31
32All JavaScript errors are handled as exceptions that *immediately* generate
33and throw an error using the standard JavaScript `throw` mechanism. These
34are handled using the [`try…catch` construct][try-catch] provided by the
35JavaScript language.
36
37```js
38// Throws with a ReferenceError because z is not defined.
39try {
40  const m = 1;
41  const n = m + z;
42} catch (err) {
43  // Handle the error here.
44}
45```
46
47Any use of the JavaScript `throw` mechanism will raise an exception that
48*must* be handled using `try…catch` or the Node.js process will exit
49immediately.
50
51With few exceptions, _Synchronous_ APIs (any blocking method that does not
52accept a `callback` function, such as [`fs.readFileSync`][]), will use `throw`
53to report errors.
54
55Errors that occur within _Asynchronous APIs_ may be reported in multiple ways:
56
57- Most asynchronous methods that accept a `callback` function will accept an
58  `Error` object passed as the first argument to that function. If that first
59  argument is not `null` and is an instance of `Error`, then an error occurred
60  that should be handled.
61
62<!-- eslint-disable no-useless-return -->
63  ```js
64  const fs = require('fs');
65  fs.readFile('a file that does not exist', (err, data) => {
66    if (err) {
67      console.error('There was an error reading the file!', err);
68      return;
69    }
70    // Otherwise handle the data
71  });
72  ```
73- When an asynchronous method is called on an object that is an
74  [`EventEmitter`][], errors can be routed to that object's `'error'` event.
75
76  ```js
77  const net = require('net');
78  const connection = net.connect('localhost');
79
80  // Adding an 'error' event handler to a stream:
81  connection.on('error', (err) => {
82    // If the connection is reset by the server, or if it can't
83    // connect at all, or on any sort of error encountered by
84    // the connection, the error will be sent here.
85    console.error(err);
86  });
87
88  connection.pipe(process.stdout);
89  ```
90
91- A handful of typically asynchronous methods in the Node.js API may still
92  use the `throw` mechanism to raise exceptions that must be handled using
93  `try…catch`. There is no comprehensive list of such methods; please
94  refer to the documentation of each method to determine the appropriate
95  error handling mechanism required.
96
97The use of the `'error'` event mechanism is most common for [stream-based][]
98and [event emitter-based][] APIs, which themselves represent a series of
99asynchronous operations over time (as opposed to a single operation that may
100pass or fail).
101
102For *all* [`EventEmitter`][] objects, if an `'error'` event handler is not
103provided, the error will be thrown, causing the Node.js process to report an
104uncaught exception and crash unless either: The [`domain`][domains] module is
105used appropriately or a handler has been registered for the
106[`'uncaughtException'`][] event.
107
108```js
109const EventEmitter = require('events');
110const ee = new EventEmitter();
111
112setImmediate(() => {
113  // This will crash the process because no 'error' event
114  // handler has been added.
115  ee.emit('error', new Error('This will crash'));
116});
117```
118
119Errors generated in this way *cannot* be intercepted using `try…catch` as
120they are thrown *after* the calling code has already exited.
121
122Developers must refer to the documentation for each method to determine
123exactly how errors raised by those methods are propagated.
124
125### Error-first callbacks
126
127<!--type=misc-->
128
129Most asynchronous methods exposed by the Node.js core API follow an idiomatic
130pattern referred to as an _error-first callback_. With this pattern, a callback
131function is passed to the method as an argument. When the operation either
132completes or an error is raised, the callback function is called with the
133`Error` object (if any) passed as the first argument. If no error was raised,
134the first argument will be passed as `null`.
135
136```js
137const fs = require('fs');
138
139function errorFirstCallback(err, data) {
140  if (err) {
141    console.error('There was an error', err);
142    return;
143  }
144  console.log(data);
145}
146
147fs.readFile('/some/file/that/does-not-exist', errorFirstCallback);
148fs.readFile('/some/file/that/does-exist', errorFirstCallback);
149```
150
151The JavaScript `try…catch` mechanism **cannot** be used to intercept errors
152generated by asynchronous APIs. A common mistake for beginners is to try to
153use `throw` inside an error-first callback:
154
155```js
156// THIS WILL NOT WORK:
157const fs = require('fs');
158
159try {
160  fs.readFile('/some/file/that/does-not-exist', (err, data) => {
161    // mistaken assumption: throwing here...
162    if (err) {
163      throw err;
164    }
165  });
166} catch (err) {
167  // This will not catch the throw!
168  console.error(err);
169}
170```
171
172This will not work because the callback function passed to `fs.readFile()` is
173called asynchronously. By the time the callback has been called, the
174surrounding code (including the `try { } catch (err) { }` block will have
175already exited. Throwing an error inside the callback **can crash the Node.js
176process** in most cases. If [domains][] are enabled, or a handler has been
177registered with `process.on('uncaughtException')`, such errors can be
178intercepted.
179
180## Class: Error
181
182<!--type=class-->
183
184A generic JavaScript `Error` object that does not denote any specific
185circumstance of why the error occurred. `Error` objects capture a "stack trace"
186detailing the point in the code at which the `Error` was instantiated, and may
187provide a text description of the error.
188
189For crypto only, `Error` objects will include the OpenSSL error stack in a
190separate property called `opensslErrorStack` if it is available when the error
191is thrown.
192
193All errors generated by Node.js, including all System and JavaScript errors,
194will either be instances of, or inherit from, the `Error` class.
195
196### new Error(message)
197
198* `message` {string}
199
200Creates a new `Error` object and sets the `error.message` property to the
201provided text message. If an object is passed as `message`, the text message
202is generated by calling `message.toString()`. The `error.stack` property will
203represent the point in the code at which `new Error()` was called. Stack traces
204are dependent on [V8's stack trace API][]. Stack traces extend only to either
205(a) the beginning of *synchronous code execution*, or (b) the number of frames
206given by the property `Error.stackTraceLimit`, whichever is smaller.
207
208### Error.captureStackTrace(targetObject[, constructorOpt])
209
210* `targetObject` {Object}
211* `constructorOpt` {Function}
212
213Creates a `.stack` property on `targetObject`, which when accessed returns
214a string representing the location in the code at which
215`Error.captureStackTrace()` was called.
216
217```js
218const myObject = {};
219Error.captureStackTrace(myObject);
220myObject.stack;  // similar to `new Error().stack`
221```
222
223The first line of the trace will be prefixed with
224`${myObject.name}: ${myObject.message}`.
225
226The optional `constructorOpt` argument accepts a function. If given, all frames
227above `constructorOpt`, including `constructorOpt`, will be omitted from the
228generated stack trace.
229
230The `constructorOpt` argument is useful for hiding implementation
231details of error generation from an end user. For instance:
232
233```js
234function MyError() {
235  Error.captureStackTrace(this, MyError);
236}
237
238// Without passing MyError to captureStackTrace, the MyError
239// frame would show up in the .stack property. By passing
240// the constructor, we omit that frame, and retain all frames below it.
241new MyError().stack;
242```
243
244### Error.stackTraceLimit
245
246* {number}
247
248The `Error.stackTraceLimit` property specifies the number of stack frames
249collected by a stack trace (whether generated by `new Error().stack` or
250`Error.captureStackTrace(obj)`).
251
252The default value is `10` but may be set to any valid JavaScript number. Changes
253will affect any stack trace captured *after* the value has been changed.
254
255If set to a non-number value, or set to a negative number, stack traces will
256not capture any frames.
257
258### error.code
259
260* {string}
261
262The `error.code` property is a string label that identifies the kind of error.
263`error.code` is the most stable way to identify an error. It will only change
264between major versions of Node.js. In contrast, `error.message` strings may
265change between any versions of Node.js. See [Node.js Error Codes][] for details
266about specific codes.
267
268### error.message
269
270* {string}
271
272The `error.message` property is the string description of the error as set by
273calling `new Error(message)`. The `message` passed to the constructor will also
274appear in the first line of the stack trace of the `Error`, however changing
275this property after the `Error` object is created *may not* change the first
276line of the stack trace (for example, when `error.stack` is read before this
277property is changed).
278
279```js
280const err = new Error('The message');
281console.error(err.message);
282// Prints: The message
283```
284
285### error.stack
286
287* {string}
288
289The `error.stack` property is a string describing the point in the code at which
290the `Error` was instantiated.
291
292```txt
293Error: Things keep happening!
294   at /home/gbusey/file.js:525:2
295   at Frobnicator.refrobulate (/home/gbusey/business-logic.js:424:21)
296   at Actor.<anonymous> (/home/gbusey/actors.js:400:8)
297   at increaseSynergy (/home/gbusey/actors.js:701:6)
298```
299
300The first line is formatted as `<error class name>: <error message>`, and
301is followed by a series of stack frames (each line beginning with "at ").
302Each frame describes a call site within the code that lead to the error being
303generated. V8 attempts to display a name for each function (by variable name,
304function name, or object method name), but occasionally it will not be able to
305find a suitable name. If V8 cannot determine a name for the function, only
306location information will be displayed for that frame. Otherwise, the
307determined function name will be displayed with location information appended
308in parentheses.
309
310Frames are only generated for JavaScript functions. If, for example, execution
311synchronously passes through a C++ addon function called `cheetahify` which
312itself calls a JavaScript function, the frame representing the `cheetahify` call
313will not be present in the stack traces:
314
315```js
316const cheetahify = require('./native-binding.node');
317
318function makeFaster() {
319  // cheetahify *synchronously* calls speedy.
320  cheetahify(function speedy() {
321    throw new Error('oh no!');
322  });
323}
324
325makeFaster();
326// will throw:
327//   /home/gbusey/file.js:6
328//       throw new Error('oh no!');
329//           ^
330//   Error: oh no!
331//       at speedy (/home/gbusey/file.js:6:11)
332//       at makeFaster (/home/gbusey/file.js:5:3)
333//       at Object.<anonymous> (/home/gbusey/file.js:10:1)
334//       at Module._compile (module.js:456:26)
335//       at Object.Module._extensions..js (module.js:474:10)
336//       at Module.load (module.js:356:32)
337//       at Function.Module._load (module.js:312:12)
338//       at Function.Module.runMain (module.js:497:10)
339//       at startup (node.js:119:16)
340//       at node.js:906:3
341```
342
343The location information will be one of:
344
345* `native`, if the frame represents a call internal to V8 (as in `[].forEach`).
346* `plain-filename.js:line:column`, if the frame represents a call internal
347   to Node.js.
348* `/absolute/path/to/file.js:line:column`, if the frame represents a call in
349  a user program, or its dependencies.
350
351The string representing the stack trace is lazily generated when the
352`error.stack` property is **accessed**.
353
354The number of frames captured by the stack trace is bounded by the smaller of
355`Error.stackTraceLimit` or the number of available frames on the current event
356loop tick.
357
358System-level errors are generated as augmented `Error` instances, which are
359detailed [here](#errors_system_errors).
360
361## Class: AssertionError
362
363A subclass of `Error` that indicates the failure of an assertion. For details,
364see [`Class: assert.AssertionError`][].
365
366## Class: RangeError
367
368A subclass of `Error` that indicates that a provided argument was not within the
369set or range of acceptable values for a function; whether that is a numeric
370range, or outside the set of options for a given function parameter.
371
372```js
373require('net').connect(-1);
374// throws "RangeError: "port" option should be >= 0 and < 65536: -1"
375```
376
377Node.js will generate and throw `RangeError` instances *immediately* as a form
378of argument validation.
379
380## Class: ReferenceError
381
382A subclass of `Error` that indicates that an attempt is being made to access a
383variable that is not defined. Such errors commonly indicate typos in code, or
384an otherwise broken program.
385
386While client code may generate and propagate these errors, in practice, only V8
387will do so.
388
389```js
390doesNotExist;
391// throws ReferenceError, doesNotExist is not a variable in this program.
392```
393
394Unless an application is dynamically generating and running code,
395`ReferenceError` instances should always be considered a bug in the code
396or its dependencies.
397
398## Class: SyntaxError
399
400A subclass of `Error` that indicates that a program is not valid JavaScript.
401These errors may only be generated and propagated as a result of code
402evaluation. Code evaluation may happen as a result of `eval`, `Function`,
403`require`, or [vm][]. These errors are almost always indicative of a broken
404program.
405
406```js
407try {
408  require('vm').runInThisContext('binary ! isNotOk');
409} catch (err) {
410  // err will be a SyntaxError
411}
412```
413
414`SyntaxError` instances are unrecoverable in the context that created them –
415they may only be caught by other contexts.
416
417## Class: TypeError
418
419A subclass of `Error` that indicates that a provided argument is not an
420allowable type. For example, passing a function to a parameter which expects a
421string would be considered a `TypeError`.
422
423```js
424require('url').parse(() => { });
425// throws TypeError, since it expected a string
426```
427
428Node.js will generate and throw `TypeError` instances *immediately* as a form
429of argument validation.
430
431## Exceptions vs. Errors
432
433<!--type=misc-->
434
435A JavaScript exception is a value that is thrown as a result of an invalid
436operation or as the target of a `throw` statement. While it is not required
437that these values are instances of `Error` or classes which inherit from
438`Error`, all exceptions thrown by Node.js or the JavaScript runtime *will* be
439instances of `Error`.
440
441Some exceptions are *unrecoverable* at the JavaScript layer. Such exceptions
442will *always* cause the Node.js process to crash. Examples include `assert()`
443checks or `abort()` calls in the C++ layer.
444
445## System Errors
446
447Node.js generates system errors when exceptions occur within its runtime
448environment. These usually occur when an application violates an operating
449system constraint. For example, a system error will occur if an application
450attempts to read a file that does not exist.
451
452System errors are usually generated at the syscall level. For a comprehensive
453list, see the [`errno`(3) man page][].
454
455In Node.js, system errors are `Error` objects with extra properties.
456
457### Class: SystemError
458
459* `address` {string} If present, the address to which a network connection
460  failed
461* `code` {string} The string error code
462* `dest` {string} If present, the file path destination when reporting a file
463  system error
464* `errno` {number|string} The system-provided error number
465* `info` {Object} If present, extra details about the error condition
466* `message` {string} A system-provided human-readable description of the error
467* `path` {string} If present, the file path when reporting a file system error
468* `port` {number} If present, the network connection port that is not available
469* `syscall` {string} The name of the system call that triggered the error
470
471#### error.address
472
473* {string}
474
475If present, `error.address` is a string describing the address to which a
476network connection failed.
477
478#### error.code
479
480* {string}
481
482The `error.code` property is a string representing the error code.
483
484#### error.dest
485
486* {string}
487
488If present, `error.dest` is the file path destination when reporting a file
489system error.
490
491#### error.errno
492
493* {string|number}
494
495The `error.errno` property is a number or a string. If it is a number, it is a
496negative value which corresponds to the error code defined in
497[`libuv Error handling`]. See the libuv `errno.h` header file
498(`deps/uv/include/uv/errno.h` in the Node.js source tree) for details. In case
499of a string, it is the same as `error.code`.
500
501#### error.info
502
503* {Object}
504
505If present, `error.info` is an object with details about the error condition.
506
507#### error.message
508
509* {string}
510
511`error.message` is a system-provided human-readable description of the error.
512
513#### error.path
514
515* {string}
516
517If present, `error.path` is a string containing a relevant invalid pathname.
518
519#### error.port
520
521* {number}
522
523If present, `error.port` is the network connection port that is not available.
524
525#### error.syscall
526
527* {string}
528
529The `error.syscall` property is a string describing the [syscall][] that failed.
530
531### Common System Errors
532
533This is a list of system errors commonly-encountered when writing a Node.js
534program. For a comprehensive list, see the [`errno`(3) man page][].
535
536- `EACCES` (Permission denied): An attempt was made to access a file in a way
537  forbidden by its file access permissions.
538
539- `EADDRINUSE` (Address already in use): An attempt to bind a server
540  ([`net`][], [`http`][], or [`https`][]) to a local address failed due to
541  another server on the local system already occupying that address.
542
543- `ECONNREFUSED` (Connection refused): No connection could be made because the
544  target machine actively refused it. This usually results from trying to
545  connect to a service that is inactive on the foreign host.
546
547- `ECONNRESET` (Connection reset by peer): A connection was forcibly closed by
548  a peer. This normally results from a loss of the connection on the remote
549  socket due to a timeout or reboot. Commonly encountered via the [`http`][]
550  and [`net`][] modules.
551
552- `EEXIST` (File exists): An existing file was the target of an operation that
553  required that the target not exist.
554
555- `EISDIR` (Is a directory): An operation expected a file, but the given
556  pathname was a directory.
557
558- `EMFILE` (Too many open files in system): Maximum number of
559  [file descriptors][] allowable on the system has been reached, and
560  requests for another descriptor cannot be fulfilled until at least one
561  has been closed. This is encountered when opening many files at once in
562  parallel, especially on systems (in particular, macOS) where there is a low
563  file descriptor limit for processes. To remedy a low limit, run
564  `ulimit -n 2048` in the same shell that will run the Node.js process.
565
566- `ENOENT` (No such file or directory): Commonly raised by [`fs`][] operations
567  to indicate that a component of the specified pathname does not exist. No
568  entity (file or directory) could be found by the given path.
569
570- `ENOTDIR` (Not a directory): A component of the given pathname existed, but
571  was not a directory as expected. Commonly raised by [`fs.readdir`][].
572
573- `ENOTEMPTY` (Directory not empty): A directory with entries was the target
574  of an operation that requires an empty directory, usually [`fs.unlink`][].
575
576- `EPERM` (Operation not permitted): An attempt was made to perform an
577  operation that requires elevated privileges.
578
579- `EPIPE` (Broken pipe): A write on a pipe, socket, or FIFO for which there is
580  no process to read the data. Commonly encountered at the [`net`][] and
581  [`http`][] layers, indicative that the remote side of the stream being
582  written to has been closed.
583
584- `ETIMEDOUT` (Operation timed out): A connect or send request failed because
585  the connected party did not properly respond after a period of time. Usually
586  encountered by [`http`][] or [`net`][]. Often a sign that a `socket.end()`
587  was not properly called.
588
589<a id="nodejs-error-codes"></a>
590## Node.js Error Codes
591
592<a id="ERR_AMBIGUOUS_ARGUMENT"></a>
593### ERR_AMBIGUOUS_ARGUMENT
594
595A function argument is being used in a way that suggests that the function
596signature may be misunderstood. This is thrown by the `assert` module when the
597`message` parameter in `assert.throws(block, message)` matches the error message
598thrown by `block` because that usage suggests that the user believes `message`
599is the expected message rather than the message the `AssertionError` will
600display if `block` does not throw.
601
602<a id="ERR_ARG_NOT_ITERABLE"></a>
603### ERR_ARG_NOT_ITERABLE
604
605An iterable argument (i.e. a value that works with `for...of` loops) was
606required, but not provided to a Node.js API.
607
608<a id="ERR_ASSERTION"></a>
609### ERR_ASSERTION
610
611A special type of error that can be triggered whenever Node.js detects an
612exceptional logic violation that should never occur. These are raised typically
613by the `assert` module.
614
615<a id="ERR_ASYNC_CALLBACK"></a>
616### ERR_ASYNC_CALLBACK
617
618An attempt was made to register something that is not a function as an
619`AsyncHooks` callback.
620
621<a id="ERR_ASYNC_TYPE"></a>
622### ERR_ASYNC_TYPE
623
624The type of an asynchronous resource was invalid. Note that users are also able
625to define their own types if using the public embedder API.
626
627<a id="ERR_BROTLI_COMPRESSION_FAILED"></a>
628### ERR_BROTLI_COMPRESSION_FAILED
629
630Data passed to a Brotli stream was not successfully compressed.
631
632<a id="ERR_BROTLI_INVALID_PARAM"></a>
633### ERR_BROTLI_INVALID_PARAM
634
635An invalid parameter key was passed during construction of a Brotli stream.
636
637<a id="ERR_BUFFER_OUT_OF_BOUNDS"></a>
638### ERR_BUFFER_OUT_OF_BOUNDS
639
640An operation outside the bounds of a `Buffer` was attempted.
641
642<a id="ERR_BUFFER_TOO_LARGE"></a>
643### ERR_BUFFER_TOO_LARGE
644
645An attempt has been made to create a `Buffer` larger than the maximum allowed
646size.
647
648<a id="ERR_CANNOT_TRANSFER_OBJECT"></a>
649### ERR_CANNOT_TRANSFER_OBJECT
650
651The value passed to `postMessage()` contained an object that is not supported
652for transferring.
653
654<a id="ERR_CANNOT_WATCH_SIGINT"></a>
655### ERR_CANNOT_WATCH_SIGINT
656
657Node.js was unable to watch for the `SIGINT` signal.
658
659<a id="ERR_CHILD_CLOSED_BEFORE_REPLY"></a>
660### ERR_CHILD_CLOSED_BEFORE_REPLY
661
662A child process was closed before the parent received a reply.
663
664<a id="ERR_CHILD_PROCESS_IPC_REQUIRED"></a>
665### ERR_CHILD_PROCESS_IPC_REQUIRED
666
667Used when a child process is being forked without specifying an IPC channel.
668
669<a id="ERR_CHILD_PROCESS_STDIO_MAXBUFFER"></a>
670### ERR_CHILD_PROCESS_STDIO_MAXBUFFER
671
672Used when the main process is trying to read data from the child process's
673STDERR/STDOUT, and the data's length is longer than the `maxBuffer` option.
674
675<a id="ERR_CLOSED_MESSAGE_PORT"></a>
676### ERR_CLOSED_MESSAGE_PORT
677
678There was an attempt to use a `MessagePort` instance in a closed
679state, usually after `.close()` has been called.
680
681<a id="ERR_CONSOLE_WRITABLE_STREAM"></a>
682### ERR_CONSOLE_WRITABLE_STREAM
683
684`Console` was instantiated without `stdout` stream, or `Console` has a
685non-writable `stdout` or `stderr` stream.
686
687<a id="ERR_CONSTRUCT_CALL_REQUIRED"></a>
688### ERR_CONSTRUCT_CALL_REQUIRED
689
690A constructor for a class was called without `new`.
691
692<a id="ERR_CPU_USAGE"></a>
693### ERR_CPU_USAGE
694
695The native call from `process.cpuUsage` could not be processed.
696
697<a id="ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED"></a>
698### ERR_CRYPTO_CUSTOM_ENGINE_NOT_SUPPORTED
699
700A client certificate engine was requested that is not supported by the version
701of OpenSSL being used.
702
703<a id="ERR_CRYPTO_ECDH_INVALID_FORMAT"></a>
704### ERR_CRYPTO_ECDH_INVALID_FORMAT
705
706An invalid value for the `format` argument was passed to the `crypto.ECDH()`
707class `getPublicKey()` method.
708
709<a id="ERR_CRYPTO_ECDH_INVALID_PUBLIC_KEY"></a>
710### ERR_CRYPTO_ECDH_INVALID_PUBLIC_KEY
711
712An invalid value for the `key` argument has been passed to the
713`crypto.ECDH()` class `computeSecret()` method. It means that the public
714key lies outside of the elliptic curve.
715
716<a id="ERR_CRYPTO_ENGINE_UNKNOWN"></a>
717### ERR_CRYPTO_ENGINE_UNKNOWN
718
719An invalid crypto engine identifier was passed to
720[`require('crypto').setEngine()`][].
721
722<a id="ERR_CRYPTO_FIPS_FORCED"></a>
723### ERR_CRYPTO_FIPS_FORCED
724
725The [`--force-fips`][] command-line argument was used but there was an attempt
726to enable or disable FIPS mode in the `crypto` module.
727
728<a id="ERR_CRYPTO_FIPS_UNAVAILABLE"></a>
729### ERR_CRYPTO_FIPS_UNAVAILABLE
730
731An attempt was made to enable or disable FIPS mode, but FIPS mode was not
732available.
733
734<a id="ERR_CRYPTO_HASH_DIGEST_NO_UTF16"></a>
735### ERR_CRYPTO_HASH_DIGEST_NO_UTF16
736
737The UTF-16 encoding was used with [`hash.digest()`][]. While the
738`hash.digest()` method does allow an `encoding` argument to be passed in,
739causing the method to return a string rather than a `Buffer`, the UTF-16
740encoding (e.g. `ucs` or `utf16le`) is not supported.
741
742<a id="ERR_CRYPTO_HASH_FINALIZED"></a>
743### ERR_CRYPTO_HASH_FINALIZED
744
745[`hash.digest()`][] was called multiple times. The `hash.digest()` method must
746be called no more than one time per instance of a `Hash` object.
747
748<a id="ERR_CRYPTO_HASH_UPDATE_FAILED"></a>
749### ERR_CRYPTO_HASH_UPDATE_FAILED
750
751[`hash.update()`][] failed for any reason. This should rarely, if ever, happen.
752
753<a id="ERR_CRYPTO_INCOMPATIBLE_KEY_OPTIONS"></a>
754### ERR_CRYPTO_INCOMPATIBLE_KEY_OPTIONS
755
756The selected public or private key encoding is incompatible with other options.
757
758<a id="ERR_CRYPTO_INVALID_DIGEST"></a>
759### ERR_CRYPTO_INVALID_DIGEST
760
761An invalid [crypto digest algorithm][] was specified.
762
763<a id="ERR_CRYPTO_INVALID_STATE"></a>
764### ERR_CRYPTO_INVALID_STATE
765
766A crypto method was used on an object that was in an invalid state. For
767instance, calling [`cipher.getAuthTag()`][] before calling `cipher.final()`.
768
769<a id="ERR_CRYPTO_PBKDF2_ERROR"></a>
770### ERR_CRYPTO_PBKDF2_ERROR
771
772The PBKDF2 algorithm failed for unspecified reasons. OpenSSL does not provide
773more details and therefore neither does Node.js.
774
775<a id="ERR_CRYPTO_SCRYPT_INVALID_PARAMETER"></a>
776### ERR_CRYPTO_SCRYPT_INVALID_PARAMETER
777
778One or more [`crypto.scrypt()`][] or [`crypto.scryptSync()`][] parameters are
779outside their legal range.
780
781<a id="ERR_CRYPTO_SCRYPT_NOT_SUPPORTED"></a>
782### ERR_CRYPTO_SCRYPT_NOT_SUPPORTED
783
784Node.js was compiled without `scrypt` support. Not possible with the official
785release binaries but can happen with custom builds, including distro builds.
786
787<a id="ERR_CRYPTO_SIGN_KEY_REQUIRED"></a>
788### ERR_CRYPTO_SIGN_KEY_REQUIRED
789
790A signing `key` was not provided to the [`sign.sign()`][] method.
791
792<a id="ERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTH"></a>
793### ERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTH
794
795[`crypto.timingSafeEqual()`][] was called with `Buffer`, `TypedArray`, or
796`DataView` arguments of different lengths.
797
798<a id="ERR_DNS_SET_SERVERS_FAILED"></a>
799### ERR_DNS_SET_SERVERS_FAILED
800
801`c-ares` failed to set the DNS server.
802
803<a id="ERR_DOMAIN_CALLBACK_NOT_AVAILABLE"></a>
804### ERR_DOMAIN_CALLBACK_NOT_AVAILABLE
805
806The `domain` module was not usable since it could not establish the required
807error handling hooks, because
808[`process.setUncaughtExceptionCaptureCallback()`][] had been called at an
809earlier point in time.
810
811<a id="ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE"></a>
812### ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE
813
814[`process.setUncaughtExceptionCaptureCallback()`][] could not be called
815because the `domain` module has been loaded at an earlier point in time.
816
817The stack trace is extended to include the point in time at which the
818`domain` module had been loaded.
819
820<a id="ERR_ENCODING_INVALID_ENCODED_DATA"></a>
821### ERR_ENCODING_INVALID_ENCODED_DATA
822
823Data provided to `util.TextDecoder()` API was invalid according to the encoding
824provided.
825
826<a id="ERR_ENCODING_NOT_SUPPORTED"></a>
827### ERR_ENCODING_NOT_SUPPORTED
828
829Encoding provided to `util.TextDecoder()` API was not one of the
830[WHATWG Supported Encodings][].
831
832<a id="ERR_FALSY_VALUE_REJECTION"></a>
833### ERR_FALSY_VALUE_REJECTION
834
835A `Promise` that was callbackified via `util.callbackify()` was rejected with a
836falsy value.
837
838<a id="ERR_FS_FILE_TOO_LARGE"></a>
839### ERR_FS_FILE_TOO_LARGE
840
841An attempt has been made to read a file whose size is larger than the maximum
842allowed size for a `Buffer`.
843
844<a id="ERR_FS_INVALID_SYMLINK_TYPE"></a>
845### ERR_FS_INVALID_SYMLINK_TYPE
846
847An invalid symlink type was passed to the [`fs.symlink()`][] or
848[`fs.symlinkSync()`][] methods.
849
850<a id="ERR_HTTP_HEADERS_SENT"></a>
851### ERR_HTTP_HEADERS_SENT
852
853An attempt was made to add more headers after the headers had already been sent.
854
855<a id="ERR_HTTP_INVALID_HEADER_VALUE"></a>
856### ERR_HTTP_INVALID_HEADER_VALUE
857
858An invalid HTTP header value was specified.
859
860<a id="ERR_HTTP_INVALID_STATUS_CODE"></a>
861### ERR_HTTP_INVALID_STATUS_CODE
862
863Status code was outside the regular status code range (100-999).
864
865<a id="ERR_HTTP_TRAILER_INVALID"></a>
866### ERR_HTTP_TRAILER_INVALID
867
868The `Trailer` header was set even though the transfer encoding does not support
869that.
870
871<a id="ERR_HTTP2_ALTSVC_INVALID_ORIGIN"></a>
872### ERR_HTTP2_ALTSVC_INVALID_ORIGIN
873
874HTTP/2 ALTSVC frames require a valid origin.
875
876<a id="ERR_HTTP2_ALTSVC_LENGTH"></a>
877### ERR_HTTP2_ALTSVC_LENGTH
878
879HTTP/2 ALTSVC frames are limited to a maximum of 16,382 payload bytes.
880
881<a id="ERR_HTTP2_CONNECT_AUTHORITY"></a>
882### ERR_HTTP2_CONNECT_AUTHORITY
883
884For HTTP/2 requests using the `CONNECT` method, the `:authority` pseudo-header
885is required.
886
887<a id="ERR_HTTP2_CONNECT_PATH"></a>
888### ERR_HTTP2_CONNECT_PATH
889
890For HTTP/2 requests using the `CONNECT` method, the `:path` pseudo-header is
891forbidden.
892
893<a id="ERR_HTTP2_CONNECT_SCHEME"></a>
894### ERR_HTTP2_CONNECT_SCHEME
895
896For HTTP/2 requests using the `CONNECT` method, the `:scheme` pseudo-header is
897forbidden.
898
899<a id="ERR_HTTP2_ERROR"></a>
900### ERR_HTTP2_ERROR
901
902A non-specific HTTP/2 error has occurred.
903
904<a id="ERR_HTTP2_GOAWAY_SESSION"></a>
905### ERR_HTTP2_GOAWAY_SESSION
906
907New HTTP/2 Streams may not be opened after the `Http2Session` has received a
908`GOAWAY` frame from the connected peer.
909
910<a id="ERR_HTTP2_HEADERS_AFTER_RESPOND"></a>
911### ERR_HTTP2_HEADERS_AFTER_RESPOND
912
913An additional headers was specified after an HTTP/2 response was initiated.
914
915<a id="ERR_HTTP2_HEADERS_SENT"></a>
916### ERR_HTTP2_HEADERS_SENT
917
918An attempt was made to send multiple response headers.
919
920<a id="ERR_HTTP2_HEADER_SINGLE_VALUE"></a>
921### ERR_HTTP2_HEADER_SINGLE_VALUE
922
923Multiple values were provided for an HTTP/2 header field that was required to
924have only a single value.
925
926<a id="ERR_HTTP2_INFO_STATUS_NOT_ALLOWED"></a>
927### ERR_HTTP2_INFO_STATUS_NOT_ALLOWED
928
929Informational HTTP status codes (`1xx`) may not be set as the response status
930code on HTTP/2 responses.
931
932<a id="ERR_HTTP2_INVALID_CONNECTION_HEADERS"></a>
933### ERR_HTTP2_INVALID_CONNECTION_HEADERS
934
935HTTP/1 connection specific headers are forbidden to be used in HTTP/2
936requests and responses.
937
938<a id="ERR_HTTP2_INVALID_HEADER_VALUE"></a>
939### ERR_HTTP2_INVALID_HEADER_VALUE
940
941An invalid HTTP/2 header value was specified.
942
943<a id="ERR_HTTP2_INVALID_INFO_STATUS"></a>
944### ERR_HTTP2_INVALID_INFO_STATUS
945
946An invalid HTTP informational status code has been specified. Informational
947status codes must be an integer between `100` and `199` (inclusive).
948
949<a id="ERR_HTTP2_INVALID_ORIGIN"></a>
950### ERR_HTTP2_INVALID_ORIGIN
951
952HTTP/2 `ORIGIN` frames require a valid origin.
953
954<a id="ERR_HTTP2_INVALID_PACKED_SETTINGS_LENGTH"></a>
955### ERR_HTTP2_INVALID_PACKED_SETTINGS_LENGTH
956
957Input `Buffer` and `Uint8Array` instances passed to the
958`http2.getUnpackedSettings()` API must have a length that is a multiple of
959six.
960
961<a id="ERR_HTTP2_INVALID_PSEUDOHEADER"></a>
962### ERR_HTTP2_INVALID_PSEUDOHEADER
963
964Only valid HTTP/2 pseudoheaders (`:status`, `:path`, `:authority`, `:scheme`,
965and `:method`) may be used.
966
967<a id="ERR_HTTP2_INVALID_SESSION"></a>
968### ERR_HTTP2_INVALID_SESSION
969
970An action was performed on an `Http2Session` object that had already been
971destroyed.
972
973<a id="ERR_HTTP2_INVALID_SETTING_VALUE"></a>
974### ERR_HTTP2_INVALID_SETTING_VALUE
975
976An invalid value has been specified for an HTTP/2 setting.
977
978<a id="ERR_HTTP2_INVALID_STREAM"></a>
979### ERR_HTTP2_INVALID_STREAM
980
981An operation was performed on a stream that had already been destroyed.
982
983<a id="ERR_HTTP2_MAX_PENDING_SETTINGS_ACK"></a>
984### ERR_HTTP2_MAX_PENDING_SETTINGS_ACK
985
986Whenever an HTTP/2 `SETTINGS` frame is sent to a connected peer, the peer is
987required to send an acknowledgment that it has received and applied the new
988`SETTINGS`. By default, a maximum number of unacknowledged `SETTINGS` frames may
989be sent at any given time. This error code is used when that limit has been
990reached.
991
992<a id="ERR_HTTP2_NESTED_PUSH"></a>
993### ERR_HTTP2_NESTED_PUSH
994
995An attempt was made to initiate a new push stream from within a push stream.
996Nested push streams are not permitted.
997
998<a id="ERR_HTTP2_NO_SOCKET_MANIPULATION"></a>
999### ERR_HTTP2_NO_SOCKET_MANIPULATION
1000
1001An attempt was made to directly manipulate (read, write, pause, resume, etc.) a
1002socket attached to an `Http2Session`.
1003
1004<a id="ERR_HTTP2_ORIGIN_LENGTH"></a>
1005### ERR_HTTP2_ORIGIN_LENGTH
1006
1007HTTP/2 `ORIGIN` frames are limited to a length of 16382 bytes.
1008
1009<a id="ERR_HTTP2_OUT_OF_STREAMS"></a>
1010### ERR_HTTP2_OUT_OF_STREAMS
1011
1012The number of streams created on a single HTTP/2 session reached the maximum
1013limit.
1014
1015<a id="ERR_HTTP2_PAYLOAD_FORBIDDEN"></a>
1016### ERR_HTTP2_PAYLOAD_FORBIDDEN
1017
1018A message payload was specified for an HTTP response code for which a payload is
1019forbidden.
1020
1021<a id="ERR_HTTP2_PING_CANCEL"></a>
1022### ERR_HTTP2_PING_CANCEL
1023
1024An HTTP/2 ping was canceled.
1025
1026<a id="ERR_HTTP2_PING_LENGTH"></a>
1027### ERR_HTTP2_PING_LENGTH
1028
1029HTTP/2 ping payloads must be exactly 8 bytes in length.
1030
1031<a id="ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED"></a>
1032### ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED
1033
1034An HTTP/2 pseudo-header has been used inappropriately. Pseudo-headers are header
1035key names that begin with the `:` prefix.
1036
1037<a id="ERR_HTTP2_PUSH_DISABLED"></a>
1038### ERR_HTTP2_PUSH_DISABLED
1039
1040An attempt was made to create a push stream, which had been disabled by the
1041client.
1042
1043<a id="ERR_HTTP2_SEND_FILE"></a>
1044### ERR_HTTP2_SEND_FILE
1045
1046An attempt was made to use the `Http2Stream.prototype.responseWithFile()` API to
1047send a directory.
1048
1049<a id="ERR_HTTP2_SEND_FILE_NOSEEK"></a>
1050### ERR_HTTP2_SEND_FILE_NOSEEK
1051
1052An attempt was made to use the `Http2Stream.prototype.responseWithFile()` API to
1053send something other than a regular file, but `offset` or `length` options were
1054provided.
1055
1056<a id="ERR_HTTP2_SESSION_ERROR"></a>
1057### ERR_HTTP2_SESSION_ERROR
1058
1059The `Http2Session` closed with a non-zero error code.
1060
1061<a id="ERR_HTTP2_SETTINGS_CANCEL"></a>
1062### ERR_HTTP2_SETTINGS_CANCEL
1063
1064The `Http2Session` settings canceled.
1065
1066<a id="ERR_HTTP2_SOCKET_BOUND"></a>
1067### ERR_HTTP2_SOCKET_BOUND
1068
1069An attempt was made to connect a `Http2Session` object to a `net.Socket` or
1070`tls.TLSSocket` that had already been bound to another `Http2Session` object.
1071
1072<a id="ERR_HTTP2_SOCKET_UNBOUND"></a>
1073### ERR_HTTP2_SOCKET_UNBOUND
1074
1075An attempt was made to use the `socket` property of an `Http2Session` that
1076has already been closed.
1077
1078<a id="ERR_HTTP2_STATUS_101"></a>
1079### ERR_HTTP2_STATUS_101
1080
1081Use of the `101` Informational status code is forbidden in HTTP/2.
1082
1083<a id="ERR_HTTP2_STATUS_INVALID"></a>
1084### ERR_HTTP2_STATUS_INVALID
1085
1086An invalid HTTP status code has been specified. Status codes must be an integer
1087between `100` and `599` (inclusive).
1088
1089<a id="ERR_HTTP2_STREAM_CANCEL"></a>
1090### ERR_HTTP2_STREAM_CANCEL
1091
1092An `Http2Stream` was destroyed before any data was transmitted to the connected
1093peer.
1094
1095<a id="ERR_HTTP2_STREAM_ERROR"></a>
1096### ERR_HTTP2_STREAM_ERROR
1097
1098A non-zero error code was been specified in an `RST_STREAM` frame.
1099
1100<a id="ERR_HTTP2_STREAM_SELF_DEPENDENCY"></a>
1101### ERR_HTTP2_STREAM_SELF_DEPENDENCY
1102
1103When setting the priority for an HTTP/2 stream, the stream may be marked as
1104a dependency for a parent stream. This error code is used when an attempt is
1105made to mark a stream and dependent of itself.
1106
1107<a id="ERR_HTTP2_TRAILERS_ALREADY_SENT"></a>
1108### ERR_HTTP2_TRAILERS_ALREADY_SENT
1109
1110Trailing headers have already been sent on the `Http2Stream`.
1111
1112<a id="ERR_HTTP2_TRAILERS_NOT_READY"></a>
1113### ERR_HTTP2_TRAILERS_NOT_READY
1114
1115The `http2stream.sendTrailers()` method cannot be called until after the
1116`'wantTrailers'` event is emitted on an `Http2Stream` object. The
1117`'wantTrailers'` event will only be emitted if the `waitForTrailers` option
1118is set for the `Http2Stream`.
1119
1120<a id="ERR_HTTP2_UNSUPPORTED_PROTOCOL"></a>
1121### ERR_HTTP2_UNSUPPORTED_PROTOCOL
1122
1123`http2.connect()` was passed a URL that uses any protocol other than `http:` or
1124`https:`.
1125
1126<a id="ERR_INDEX_OUT_OF_RANGE"></a>
1127### ERR_INDEX_OUT_OF_RANGE
1128
1129A given index was out of the accepted range (e.g. negative offsets).
1130
1131<a id="ERR_INSPECTOR_ALREADY_CONNECTED"></a>
1132### ERR_INSPECTOR_ALREADY_CONNECTED
1133
1134While using the `inspector` module, an attempt was made to connect when the
1135inspector was already connected.
1136
1137<a id="ERR_INSPECTOR_CLOSED"></a>
1138### ERR_INSPECTOR_CLOSED
1139
1140While using the `inspector` module, an attempt was made to use the inspector
1141after the session had already closed.
1142
1143<a id="ERR_INSPECTOR_NOT_AVAILABLE"></a>
1144### ERR_INSPECTOR_NOT_AVAILABLE
1145
1146The `inspector` module is not available for use.
1147
1148<a id="ERR_INSPECTOR_NOT_CONNECTED"></a>
1149### ERR_INSPECTOR_NOT_CONNECTED
1150
1151While using the `inspector` module, an attempt was made to use the inspector
1152before it was connected.
1153
1154<a id="ERR_INVALID_ADDRESS_FAMILY"></a>
1155### ERR_INVALID_ADDRESS_FAMILY
1156
1157The provided address family is not understood by the Node.js API.
1158
1159<a id="ERR_INVALID_ARG_TYPE"></a>
1160### ERR_INVALID_ARG_TYPE
1161
1162An argument of the wrong type was passed to a Node.js API.
1163
1164<a id="ERR_INVALID_ARG_VALUE"></a>
1165### ERR_INVALID_ARG_VALUE
1166
1167An invalid or unsupported value was passed for a given argument.
1168
1169<a id="ERR_INVALID_ARRAY_LENGTH"></a>
1170### ERR_INVALID_ARRAY_LENGTH
1171
1172An array was not of the expected length or in a valid range.
1173
1174<a id="ERR_INVALID_ASYNC_ID"></a>
1175### ERR_INVALID_ASYNC_ID
1176
1177An invalid `asyncId` or `triggerAsyncId` was passed using `AsyncHooks`. An id
1178less than -1 should never happen.
1179
1180<a id="ERR_INVALID_BUFFER_SIZE"></a>
1181### ERR_INVALID_BUFFER_SIZE
1182
1183A swap was performed on a `Buffer` but its size was not compatible with the
1184operation.
1185
1186<a id="ERR_INVALID_CALLBACK"></a>
1187### ERR_INVALID_CALLBACK
1188
1189A callback function was required but was not been provided to a Node.js API.
1190
1191<a id="ERR_INVALID_CHAR"></a>
1192### ERR_INVALID_CHAR
1193
1194Invalid characters were detected in headers.
1195
1196<a id="ERR_INVALID_CURSOR_POS"></a>
1197### ERR_INVALID_CURSOR_POS
1198
1199A cursor on a given stream cannot be moved to a specified row without a
1200specified column.
1201
1202<a id="ERR_INVALID_DOMAIN_NAME"></a>
1203### ERR_INVALID_DOMAIN_NAME
1204
1205`hostname` can not be parsed from a provided URL.
1206
1207<a id="ERR_INVALID_FD"></a>
1208### ERR_INVALID_FD
1209
1210A file descriptor ('fd') was not valid (e.g. it was a negative value).
1211
1212<a id="ERR_INVALID_FD_TYPE"></a>
1213### ERR_INVALID_FD_TYPE
1214
1215A file descriptor ('fd') type was not valid.
1216
1217<a id="ERR_INVALID_FILE_URL_HOST"></a>
1218### ERR_INVALID_FILE_URL_HOST
1219
1220A Node.js API that consumes `file:` URLs (such as certain functions in the
1221[`fs`][] module) encountered a file URL with an incompatible host. This
1222situation can only occur on Unix-like systems where only `localhost` or an empty
1223host is supported.
1224
1225<a id="ERR_INVALID_FILE_URL_PATH"></a>
1226### ERR_INVALID_FILE_URL_PATH
1227
1228A Node.js API that consumes `file:` URLs (such as certain functions in the
1229[`fs`][] module) encountered a file URL with an incompatible path. The exact
1230semantics for determining whether a path can be used is platform-dependent.
1231
1232<a id="ERR_INVALID_HANDLE_TYPE"></a>
1233### ERR_INVALID_HANDLE_TYPE
1234
1235An attempt was made to send an unsupported "handle" over an IPC communication
1236channel to a child process. See [`subprocess.send()`] and [`process.send()`] for
1237more information.
1238
1239<a id="ERR_INVALID_HTTP_TOKEN"></a>
1240### ERR_INVALID_HTTP_TOKEN
1241
1242An invalid HTTP token was supplied.
1243
1244<a id="ERR_INVALID_IP_ADDRESS"></a>
1245### ERR_INVALID_IP_ADDRESS
1246
1247An IP address is not valid.
1248
1249<a id="ERR_INVALID_OPT_VALUE"></a>
1250### ERR_INVALID_OPT_VALUE
1251
1252An invalid or unexpected value was passed in an options object.
1253
1254<a id="ERR_INVALID_OPT_VALUE_ENCODING"></a>
1255### ERR_INVALID_OPT_VALUE_ENCODING
1256
1257An invalid or unknown file encoding was passed.
1258
1259<a id="ERR_INVALID_PERFORMANCE_MARK"></a>
1260### ERR_INVALID_PERFORMANCE_MARK
1261
1262While using the Performance Timing API (`perf_hooks`), a performance mark is
1263invalid.
1264
1265<a id="ERR_INVALID_PROTOCOL"></a>
1266### ERR_INVALID_PROTOCOL
1267
1268An invalid `options.protocol` was passed.
1269
1270<a id="ERR_INVALID_REPL_EVAL_CONFIG"></a>
1271### ERR_INVALID_REPL_EVAL_CONFIG
1272
1273Both `breakEvalOnSigint` and `eval` options were set in the REPL config, which
1274is not supported.
1275
1276<a id="ERR_INVALID_RETURN_PROPERTY"></a>
1277### ERR_INVALID_RETURN_PROPERTY
1278
1279Thrown in case a function option does not provide a valid value for one of its
1280returned object properties on execution.
1281
1282<a id="ERR_INVALID_RETURN_PROPERTY_VALUE"></a>
1283### ERR_INVALID_RETURN_PROPERTY_VALUE
1284
1285Thrown in case a function option does not provide an expected value
1286type for one of its returned object properties on execution.
1287
1288<a id="ERR_INVALID_RETURN_VALUE"></a>
1289### ERR_INVALID_RETURN_VALUE
1290
1291Thrown in case a function option does not return an expected value
1292type on execution, such as when a function is expected to return a promise.
1293
1294<a id="ERR_INVALID_SYNC_FORK_INPUT"></a>
1295### ERR_INVALID_SYNC_FORK_INPUT
1296
1297A `Buffer`, `TypedArray`, `DataView` or `string` was provided as stdio input to
1298an asynchronous fork. See the documentation for the [`child_process`][] module
1299for more information.
1300
1301<a id="ERR_INVALID_THIS"></a>
1302### ERR_INVALID_THIS
1303
1304A Node.js API function was called with an incompatible `this` value.
1305
1306```js
1307const urlSearchParams = new URLSearchParams('foo=bar&baz=new');
1308
1309const buf = Buffer.alloc(1);
1310urlSearchParams.has.call(buf, 'foo');
1311// Throws a TypeError with code 'ERR_INVALID_THIS'
1312```
1313
1314<a id="ERR_INVALID_TRANSFER_OBJECT"></a>
1315### ERR_INVALID_TRANSFER_OBJECT
1316
1317An invalid transfer object was passed to `postMessage()`.
1318
1319<a id="ERR_INVALID_TUPLE"></a>
1320### ERR_INVALID_TUPLE
1321
1322An element in the `iterable` provided to the [WHATWG][WHATWG URL API]
1323[`URLSearchParams` constructor][`new URLSearchParams(iterable)`] did not
1324represent a `[name, value]` tuple – that is, if an element is not iterable, or
1325does not consist of exactly two elements.
1326
1327<a id="ERR_INVALID_URI"></a>
1328### ERR_INVALID_URI
1329
1330An invalid URI was passed.
1331
1332<a id="ERR_INVALID_URL"></a>
1333### ERR_INVALID_URL
1334
1335An invalid URL was passed to the [WHATWG][WHATWG URL API]
1336[`URL` constructor][`new URL(input)`] to be parsed. The thrown error object
1337typically has an additional property `'input'` that contains the URL that failed
1338to parse.
1339
1340<a id="ERR_INVALID_URL_SCHEME"></a>
1341### ERR_INVALID_URL_SCHEME
1342
1343An attempt was made to use a URL of an incompatible scheme (protocol) for a
1344specific purpose. It is only used in the [WHATWG URL API][] support in the
1345[`fs`][] module (which only accepts URLs with `'file'` scheme), but may be used
1346in other Node.js APIs as well in the future.
1347
1348<a id="ERR_IPC_CHANNEL_CLOSED"></a>
1349### ERR_IPC_CHANNEL_CLOSED
1350
1351An attempt was made to use an IPC communication channel that was already closed.
1352
1353<a id="ERR_IPC_DISCONNECTED"></a>
1354### ERR_IPC_DISCONNECTED
1355
1356An attempt was made to disconnect an IPC communication channel that was already
1357disconnected. See the documentation for the [`child_process`][] module
1358for more information.
1359
1360<a id="ERR_IPC_ONE_PIPE"></a>
1361### ERR_IPC_ONE_PIPE
1362
1363An attempt was made to create a child Node.js process using more than one IPC
1364communication channel. See the documentation for the [`child_process`][] module
1365for more information.
1366
1367<a id="ERR_IPC_SYNC_FORK"></a>
1368### ERR_IPC_SYNC_FORK
1369
1370An attempt was made to open an IPC communication channel with a synchronously
1371forked Node.js process. See the documentation for the [`child_process`][] module
1372for more information.
1373
1374<a id="ERR_MEMORY_ALLOCATION_FAILED"></a>
1375### ERR_MEMORY_ALLOCATION_FAILED
1376
1377An attempt was made to allocate memory (usually in the C++ layer) but it
1378failed.
1379
1380<a id="ERR_METHOD_NOT_IMPLEMENTED"></a>
1381### ERR_METHOD_NOT_IMPLEMENTED
1382
1383A method is required but not implemented.
1384
1385<a id="ERR_MISSING_ARGS"></a>
1386### ERR_MISSING_ARGS
1387
1388A required argument of a Node.js API was not passed. This is only used for
1389strict compliance with the API specification (which in some cases may accept
1390`func(undefined)` but not `func()`). In most native Node.js APIs,
1391`func(undefined)` and `func()` are treated identically, and the
1392[`ERR_INVALID_ARG_TYPE`][] error code may be used instead.
1393
1394<a id="ERR_MISSING_DYNAMIC_INSTANTIATE_HOOK"></a>
1395### ERR_MISSING_DYNAMIC_INSTANTIATE_HOOK
1396
1397> Stability: 1 - Experimental
1398
1399An [ES6 module][] loader hook specified `format: 'dynamic'` but did not provide
1400a `dynamicInstantiate` hook.
1401
1402<a id="ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST"></a>
1403### ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST
1404
1405A `MessagePort` was found in the object passed to a `postMessage()` call,
1406but not provided in the `transferList` for that call.
1407
1408<a id="ERR_MISSING_MODULE"></a>
1409### ERR_MISSING_MODULE
1410
1411> Stability: 1 - Experimental
1412
1413An [ES6 module][] could not be resolved.
1414
1415<a id="ERR_MISSING_PLATFORM_FOR_WORKER"></a>
1416### ERR_MISSING_PLATFORM_FOR_WORKER
1417
1418The V8 platform used by this instance of Node.js does not support creating
1419Workers. This is caused by lack of embedder support for Workers. In particular,
1420this error will not occur with standard builds of Node.js.
1421
1422<a id="ERR_MODULE_RESOLUTION_LEGACY"></a>
1423### ERR_MODULE_RESOLUTION_LEGACY
1424
1425> Stability: 1 - Experimental
1426
1427A failure occurred resolving imports in an [ES6 module][].
1428
1429<a id="ERR_MULTIPLE_CALLBACK"></a>
1430### ERR_MULTIPLE_CALLBACK
1431
1432A callback was called more than once.
1433
1434A callback is almost always meant to only be called once as the query
1435can either be fulfilled or rejected but not both at the same time. The latter
1436would be possible by calling a callback more than once.
1437
1438<a id="ERR_NAPI_CONS_FUNCTION"></a>
1439### ERR_NAPI_CONS_FUNCTION
1440
1441While using `N-API`, a constructor passed was not a function.
1442
1443<a id="ERR_NAPI_INVALID_DATAVIEW_ARGS"></a>
1444### ERR_NAPI_INVALID_DATAVIEW_ARGS
1445
1446While calling `napi_create_dataview()`, a given `offset` was outside the bounds
1447of the dataview or `offset + length` was larger than a length of given `buffer`.
1448
1449<a id="ERR_NAPI_INVALID_TYPEDARRAY_ALIGNMENT"></a>
1450### ERR_NAPI_INVALID_TYPEDARRAY_ALIGNMENT
1451
1452While calling `napi_create_typedarray()`, the provided `offset` was not a
1453multiple of the element size.
1454
1455<a id="ERR_NAPI_INVALID_TYPEDARRAY_LENGTH"></a>
1456### ERR_NAPI_INVALID_TYPEDARRAY_LENGTH
1457
1458While calling `napi_create_typedarray()`, `(length * size_of_element) +
1459byte_offset` was larger than the length of given `buffer`.
1460
1461<a id="ERR_NAPI_TSFN_CALL_JS"></a>
1462### ERR_NAPI_TSFN_CALL_JS
1463
1464An error occurred while invoking the JavaScript portion of the thread-safe
1465function.
1466
1467<a id="ERR_NAPI_TSFN_GET_UNDEFINED"></a>
1468### ERR_NAPI_TSFN_GET_UNDEFINED
1469
1470An error occurred while attempting to retrieve the JavaScript `undefined`
1471value.
1472
1473<a id="ERR_NAPI_TSFN_START_IDLE_LOOP"></a>
1474### ERR_NAPI_TSFN_START_IDLE_LOOP
1475
1476On the main thread, values are removed from the queue associated with the
1477thread-safe function in an idle loop. This error indicates that an error
1478has occurred when attempting to start the loop.
1479
1480<a id="ERR_NAPI_TSFN_STOP_IDLE_LOOP"></a>
1481### ERR_NAPI_TSFN_STOP_IDLE_LOOP
1482
1483Once no more items are left in the queue, the idle loop must be suspended. This
1484error indicates that the idle loop has failed to stop.
1485
1486<a id="ERR_NO_CRYPTO"></a>
1487### ERR_NO_CRYPTO
1488
1489An attempt was made to use crypto features while Node.js was not compiled with
1490OpenSSL crypto support.
1491
1492<a id="ERR_NO_ICU"></a>
1493### ERR_NO_ICU
1494
1495An attempt was made to use features that require [ICU][], but Node.js was not
1496compiled with ICU support.
1497
1498<a id="ERR_NO_LONGER_SUPPORTED"></a>
1499### ERR_NO_LONGER_SUPPORTED
1500
1501A Node.js API was called in an unsupported manner, such as
1502`Buffer.write(string, encoding, offset[, length])`.
1503
1504<a id="ERR_OUT_OF_RANGE"></a>
1505### ERR_OUT_OF_RANGE
1506
1507A given value is out of the accepted range.
1508
1509<a id="ERR_REQUIRE_ESM"></a>
1510### ERR_REQUIRE_ESM
1511
1512> Stability: 1 - Experimental
1513
1514An attempt was made to `require()` an [ES6 module][].
1515
1516<a id="ERR_SCRIPT_EXECUTION_INTERRUPTED"></a>
1517### ERR_SCRIPT_EXECUTION_INTERRUPTED
1518
1519Script execution was interrupted by `SIGINT` (For example, when Ctrl+C was
1520pressed).
1521
1522<a id="ERR_SERVER_ALREADY_LISTEN"></a>
1523### ERR_SERVER_ALREADY_LISTEN
1524
1525The [`server.listen()`][] method was called while a `net.Server` was already
1526listening. This applies to all instances of `net.Server`, including HTTP, HTTPS,
1527and HTTP/2 `Server` instances.
1528
1529<a id="ERR_SERVER_NOT_RUNNING"></a>
1530### ERR_SERVER_NOT_RUNNING
1531
1532The [`server.close()`][] method was called when a `net.Server` was not
1533running. This applies to all instances of `net.Server`, including HTTP, HTTPS,
1534and HTTP/2 `Server` instances.
1535
1536<a id="ERR_SOCKET_ALREADY_BOUND"></a>
1537### ERR_SOCKET_ALREADY_BOUND
1538
1539An attempt was made to bind a socket that has already been bound.
1540
1541<a id="ERR_SOCKET_BAD_BUFFER_SIZE"></a>
1542### ERR_SOCKET_BAD_BUFFER_SIZE
1543
1544An invalid (negative) size was passed for either the `recvBufferSize` or
1545`sendBufferSize` options in [`dgram.createSocket()`][].
1546
1547<a id="ERR_SOCKET_BAD_PORT"></a>
1548### ERR_SOCKET_BAD_PORT
1549
1550An API function expecting a port >= 0 and < 65536 received an invalid value.
1551
1552<a id="ERR_SOCKET_BAD_TYPE"></a>
1553### ERR_SOCKET_BAD_TYPE
1554
1555An API function expecting a socket type (`udp4` or `udp6`) received an invalid
1556value.
1557
1558<a id="ERR_SOCKET_BUFFER_SIZE"></a>
1559### ERR_SOCKET_BUFFER_SIZE
1560
1561While using [`dgram.createSocket()`][], the size of the receive or send `Buffer`
1562could not be determined.
1563
1564<a id="ERR_SOCKET_CANNOT_SEND"></a>
1565### ERR_SOCKET_CANNOT_SEND
1566
1567Data could be sent on a socket.
1568
1569<a id="ERR_SOCKET_CLOSED"></a>
1570### ERR_SOCKET_CLOSED
1571
1572An attempt was made to operate on an already closed socket.
1573
1574<a id="ERR_SOCKET_DGRAM_NOT_RUNNING"></a>
1575### ERR_SOCKET_DGRAM_NOT_RUNNING
1576
1577A call was made and the UDP subsystem was not running.
1578
1579<a id="ERR_STREAM_CANNOT_PIPE"></a>
1580### ERR_STREAM_CANNOT_PIPE
1581
1582An attempt was made to call [`stream.pipe()`][] on a [`Writable`][] stream.
1583
1584<a id="ERR_STREAM_DESTROYED"></a>
1585### ERR_STREAM_DESTROYED
1586
1587A stream method was called that cannot complete because the stream was
1588destroyed using `stream.destroy()`.
1589
1590<a id="ERR_STREAM_NULL_VALUES"></a>
1591### ERR_STREAM_NULL_VALUES
1592
1593An attempt was made to call [`stream.write()`][] with a `null` chunk.
1594
1595<a id="ERR_STREAM_PREMATURE_CLOSE"></a>
1596### ERR_STREAM_PREMATURE_CLOSE
1597
1598An error returned by `stream.finished()` and `stream.pipeline()`, when a stream
1599or a pipeline ends non gracefully with no explicit error.
1600
1601<a id="ERR_STREAM_PUSH_AFTER_EOF"></a>
1602### ERR_STREAM_PUSH_AFTER_EOF
1603
1604An attempt was made to call [`stream.push()`][] after a `null`(EOF) had been
1605pushed to the stream.
1606
1607<a id="ERR_STREAM_UNSHIFT_AFTER_END_EVENT"></a>
1608### ERR_STREAM_UNSHIFT_AFTER_END_EVENT
1609
1610An attempt was made to call [`stream.unshift()`][] after the `'end'` event was
1611emitted.
1612
1613<a id="ERR_STREAM_WRAP"></a>
1614### ERR_STREAM_WRAP
1615
1616Prevents an abort if a string decoder was set on the Socket or if the decoder
1617is in `objectMode`.
1618
1619```js
1620const Socket = require('net').Socket;
1621const instance = new Socket();
1622
1623instance.setEncoding('utf8');
1624```
1625
1626<a id="ERR_STREAM_WRITE_AFTER_END"></a>
1627### ERR_STREAM_WRITE_AFTER_END
1628
1629An attempt was made to call [`stream.write()`][] after `stream.end()` has been
1630called.
1631
1632<a id="ERR_STRING_TOO_LONG"></a>
1633### ERR_STRING_TOO_LONG
1634
1635An attempt has been made to create a string longer than the maximum allowed
1636length.
1637
1638<a id="ERR_SYSTEM_ERROR"></a>
1639### ERR_SYSTEM_ERROR
1640
1641An unspecified or non-specific system error has occurred within the Node.js
1642process. The error object will have an `err.info` object property with
1643additional details.
1644
1645<a id="ERR_TLS_CERT_ALTNAME_INVALID"></a>
1646### ERR_TLS_CERT_ALTNAME_INVALID
1647
1648While using TLS, the hostname/IP of the peer did not match any of the
1649`subjectAltNames` in its certificate.
1650
1651<a id="ERR_TLS_DH_PARAM_SIZE"></a>
1652### ERR_TLS_DH_PARAM_SIZE
1653
1654While using TLS, the parameter offered for the Diffie-Hellman (`DH`)
1655key-agreement protocol is too small. By default, the key length must be greater
1656than or equal to 1024 bits to avoid vulnerabilities, even though it is strongly
1657recommended to use 2048 bits or larger for stronger security.
1658
1659<a id="ERR_TLS_HANDSHAKE_TIMEOUT"></a>
1660### ERR_TLS_HANDSHAKE_TIMEOUT
1661
1662A TLS/SSL handshake timed out. In this case, the server must also abort the
1663connection.
1664
1665<a id="ERR_TLS_INVALID_PROTOCOL_VERSION"></a>
1666### ERR_TLS_INVALID_PROTOCOL_VERSION
1667
1668Valid TLS protocol versions are `'TLSv1'`, `'TLSv1.1'`, or `'TLSv1.2'`.
1669
1670<a id="ERR_TLS_PROTOCOL_VERSION_CONFLICT"></a>
1671### ERR_TLS_PROTOCOL_VERSION_CONFLICT
1672
1673Attempting to set a TLS protocol `minVersion` or `maxVersion` conflicts with an
1674attempt to set the `secureProtocol` explicitly. Use one mechanism or the other.
1675
1676<a id="ERR_TLS_RENEGOTIATE"></a>
1677### ERR_TLS_RENEGOTIATE
1678
1679An attempt to renegotiate the TLS session failed.
1680
1681<a id="ERR_TLS_RENEGOTIATION_DISABLED"></a>
1682### ERR_TLS_RENEGOTIATION_DISABLED
1683
1684An attempt was made to renegotiate TLS on a socket instance with TLS disabled.
1685
1686<a id="ERR_TLS_REQUIRED_SERVER_NAME"></a>
1687### ERR_TLS_REQUIRED_SERVER_NAME
1688
1689While using TLS, the `server.addContext()` method was called without providing
1690a hostname in the first parameter.
1691
1692<a id="ERR_TLS_SESSION_ATTACK"></a>
1693### ERR_TLS_SESSION_ATTACK
1694
1695An excessive amount of TLS renegotiations is detected, which is a potential
1696vector for denial-of-service attacks.
1697
1698<a id="ERR_TLS_SNI_FROM_SERVER"></a>
1699### ERR_TLS_SNI_FROM_SERVER
1700
1701An attempt was made to issue Server Name Indication from a TLS server-side
1702socket, which is only valid from a client.
1703
1704<a id="ERR_TRACE_EVENTS_CATEGORY_REQUIRED"></a>
1705### ERR_TRACE_EVENTS_CATEGORY_REQUIRED
1706
1707The `trace_events.createTracing()` method requires at least one trace event
1708category.
1709
1710<a id="ERR_TRACE_EVENTS_UNAVAILABLE"></a>
1711### ERR_TRACE_EVENTS_UNAVAILABLE
1712
1713The `trace_events` module could not be loaded because Node.js was compiled with
1714the `--without-v8-platform` flag.
1715
1716<a id="ERR_TRANSFERRING_EXTERNALIZED_SHAREDARRAYBUFFER"></a>
1717### ERR_TRANSFERRING_EXTERNALIZED_SHAREDARRAYBUFFER
1718
1719A `SharedArrayBuffer` whose memory is not managed by the JavaScript engine
1720or by Node.js was encountered during serialization. Such a `SharedArrayBuffer`
1721cannot be serialized.
1722
1723This can only happen when native addons create `SharedArrayBuffer`s in
1724"externalized" mode, or put existing `SharedArrayBuffer` into externalized mode.
1725
1726<a id="ERR_TRANSFORM_ALREADY_TRANSFORMING"></a>
1727### ERR_TRANSFORM_ALREADY_TRANSFORMING
1728
1729A `Transform` stream finished while it was still transforming.
1730
1731<a id="ERR_TRANSFORM_WITH_LENGTH_0"></a>
1732### ERR_TRANSFORM_WITH_LENGTH_0
1733
1734A `Transform` stream finished with data still in the write buffer.
1735
1736<a id="ERR_TTY_INIT_FAILED"></a>
1737### ERR_TTY_INIT_FAILED
1738
1739The initialization of a TTY failed due to a system error.
1740
1741<a id="ERR_UNCAUGHT_EXCEPTION_CAPTURE_ALREADY_SET"></a>
1742### ERR_UNCAUGHT_EXCEPTION_CAPTURE_ALREADY_SET
1743
1744[`process.setUncaughtExceptionCaptureCallback()`][] was called twice,
1745without first resetting the callback to `null`.
1746
1747This error is designed to prevent accidentally overwriting a callback registered
1748from another module.
1749
1750<a id="ERR_UNESCAPED_CHARACTERS"></a>
1751### ERR_UNESCAPED_CHARACTERS
1752
1753A string that contained unescaped characters was received.
1754
1755<a id="ERR_UNHANDLED_ERROR"></a>
1756### ERR_UNHANDLED_ERROR
1757
1758An unhandled error occurred (for instance, when an `'error'` event is emitted
1759by an [`EventEmitter`][] but an `'error'` handler is not registered).
1760
1761<a id="ERR_UNKNOWN_BUILTIN_MODULE"></a>
1762### ERR_UNKNOWN_BUILTIN_MODULE
1763
1764Used to identify a specific kind of internal Node.js error that should not
1765typically be triggered by user code. Instances of this error point to an
1766internal bug within the Node.js binary itself.
1767
1768<a id="ERR_UNKNOWN_ENCODING"></a>
1769### ERR_UNKNOWN_ENCODING
1770
1771An invalid or unknown encoding option was passed to an API.
1772
1773<a id="ERR_UNKNOWN_FILE_EXTENSION"></a>
1774### ERR_UNKNOWN_FILE_EXTENSION
1775
1776> Stability: 1 - Experimental
1777
1778An attempt was made to load a module with an unknown or unsupported file
1779extension.
1780
1781<a id="ERR_UNKNOWN_MODULE_FORMAT"></a>
1782### ERR_UNKNOWN_MODULE_FORMAT
1783
1784> Stability: 1 - Experimental
1785
1786An attempt was made to load a module with an unknown or unsupported format.
1787
1788<a id="ERR_UNKNOWN_SIGNAL"></a>
1789### ERR_UNKNOWN_SIGNAL
1790
1791An invalid or unknown process signal was passed to an API expecting a valid
1792signal (such as [`subprocess.kill()`][]).
1793
1794<a id="ERR_UNKNOWN_STDIN_TYPE"></a>
1795### ERR_UNKNOWN_STDIN_TYPE
1796
1797An attempt was made to launch a Node.js process with an unknown `stdin` file
1798type. This error is usually an indication of a bug within Node.js itself,
1799although it is possible for user code to trigger it.
1800
1801<a id="ERR_UNKNOWN_STREAM_TYPE"></a>
1802### ERR_UNKNOWN_STREAM_TYPE
1803
1804An attempt was made to launch a Node.js process with an unknown `stdout` or
1805`stderr` file type. This error is usually an indication of a bug within Node.js
1806itself, although it is possible for user code to trigger it.
1807
1808<a id="ERR_V8BREAKITERATOR"></a>
1809### ERR_V8BREAKITERATOR
1810
1811The V8 `BreakIterator` API was used but the full ICU data set is not installed.
1812
1813<a id="ERR_VALID_PERFORMANCE_ENTRY_TYPE"></a>
1814### ERR_VALID_PERFORMANCE_ENTRY_TYPE
1815
1816While using the Performance Timing API (`perf_hooks`), no valid performance
1817entry types were found.
1818
1819<a id="ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING"></a>
1820### ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING
1821
1822A dynamic import callback was not specified.
1823
1824<a id="ERR_VM_MODULE_ALREADY_LINKED"></a>
1825### ERR_VM_MODULE_ALREADY_LINKED
1826
1827The module attempted to be linked is not eligible for linking, because of one of
1828the following reasons:
1829
1830- It has already been linked (`linkingStatus` is `'linked'`)
1831- It is being linked (`linkingStatus` is `'linking'`)
1832- Linking has failed for this module (`linkingStatus` is `'errored'`)
1833
1834<a id="ERR_VM_MODULE_DIFFERENT_CONTEXT"></a>
1835### ERR_VM_MODULE_DIFFERENT_CONTEXT
1836
1837The module being returned from the linker function is from a different context
1838than the parent module. Linked modules must share the same context.
1839
1840<a id="ERR_VM_MODULE_LINKING_ERRORED"></a>
1841### ERR_VM_MODULE_LINKING_ERRORED
1842
1843The linker function returned a module for which linking has failed.
1844
1845<a id="ERR_VM_MODULE_NOT_LINKED"></a>
1846### ERR_VM_MODULE_NOT_LINKED
1847
1848The module must be successfully linked before instantiation.
1849
1850<a id="ERR_VM_MODULE_NOT_MODULE"></a>
1851### ERR_VM_MODULE_NOT_MODULE
1852
1853The fulfilled value of a linking promise is not a `vm.SourceTextModule` object.
1854
1855<a id="ERR_VM_MODULE_STATUS"></a>
1856### ERR_VM_MODULE_STATUS
1857
1858The current module's status does not allow for this operation. The specific
1859meaning of the error depends on the specific function.
1860
1861<a id="ERR_WORKER_PATH"></a>
1862### ERR_WORKER_PATH
1863
1864The path for the main script of a worker is neither an absolute path
1865nor a relative path starting with `./` or `../`.
1866
1867<a id="ERR_WORKER_UNSERIALIZABLE_ERROR"></a>
1868### ERR_WORKER_UNSERIALIZABLE_ERROR
1869
1870All attempts at serializing an uncaught exception from a worker thread failed.
1871
1872<a id="ERR_WORKER_UNSUPPORTED_EXTENSION"></a>
1873### ERR_WORKER_UNSUPPORTED_EXTENSION
1874
1875The pathname used for the main script of a worker has an
1876unknown file extension.
1877
1878<a id="ERR_ZLIB_INITIALIZATION_FAILED"></a>
1879### ERR_ZLIB_INITIALIZATION_FAILED
1880
1881Creation of a [`zlib`][] object failed due to incorrect configuration.
1882
1883<a id="HPE_HEADER_OVERFLOW"></a>
1884### HPE_HEADER_OVERFLOW
1885<!-- YAML
1886changes:
1887  - version: v10.15.0
1888    pr-url: https://github.com/nodejs/node/commit/186035243fad247e3955f
1889    description: Max header size in `http_parser` was set to 8KB.
1890-->
1891
1892Too much HTTP header data was received. In order to protect against malicious or
1893malconfigured clients, if more than 8KB of HTTP header data is received then
1894HTTP parsing will abort without a request or response object being created, and
1895an `Error` with this code will be emitted.
1896
1897<a id="MODULE_NOT_FOUND"></a>
1898### MODULE_NOT_FOUND
1899
1900A module file could not be resolved while attempting a [`require()`][] or
1901`import` operation.
1902
1903## Legacy Node.js Error Codes
1904
1905> Stability: 0 - Deprecated. These error codes are either inconsistent, or have
1906> been removed.
1907
1908<a id="ERR_HTTP2_FRAME_ERROR"></a>
1909### ERR_HTTP2_FRAME_ERROR
1910<!-- YAML
1911added: v9.0.0
1912removed: v10.0.0
1913-->
1914
1915Used when a failure occurs sending an individual frame on the HTTP/2
1916session.
1917
1918<a id="ERR_HTTP2_HEADERS_OBJECT"></a>
1919### ERR_HTTP2_HEADERS_OBJECT
1920<!-- YAML
1921added: v9.0.0
1922removed: v10.0.0
1923-->
1924
1925Used when an HTTP/2 Headers Object is expected.
1926
1927<a id="ERR_HTTP2_HEADER_REQUIRED"></a>
1928### ERR_HTTP2_HEADER_REQUIRED
1929<!-- YAML
1930added: v9.0.0
1931removed: v10.0.0
1932-->
1933
1934Used when a required header is missing in an HTTP/2 message.
1935
1936<a id="ERR_HTTP2_INFO_HEADERS_AFTER_RESPOND"></a>
1937### ERR_HTTP2_INFO_HEADERS_AFTER_RESPOND
1938<!-- YAML
1939added: v9.0.0
1940removed: v10.0.0
1941-->
1942
1943HTTP/2 informational headers must only be sent *prior* to calling the
1944`Http2Stream.prototype.respond()` method.
1945
1946<a id="ERR_HTTP2_STREAM_CLOSED"></a>
1947### ERR_HTTP2_STREAM_CLOSED
1948<!-- YAML
1949added: v9.0.0
1950removed: v10.0.0
1951-->
1952
1953Used when an action has been performed on an HTTP/2 Stream that has already
1954been closed.
1955
1956<a id="ERR_HTTP_INVALID_CHAR"></a>
1957### ERR_HTTP_INVALID_CHAR
1958<!-- YAML
1959added: v9.0.0
1960removed: v10.0.0
1961-->
1962
1963Used when an invalid character is found in an HTTP response status message
1964(reason phrase).
1965
1966<a id="ERR_NAPI_CONS_PROTOTYPE_OBJECT"></a>
1967### ERR_NAPI_CONS_PROTOTYPE_OBJECT
1968<!-- YAML
1969added: v9.0.0
1970removed: v10.0.0
1971-->
1972
1973Used by the `N-API` when `Constructor.prototype` is not an object.
1974
1975<a id="ERR_OUTOFMEMORY"></a>
1976### ERR_OUTOFMEMORY
1977<!-- YAML
1978added: v9.0.0
1979removed: v10.0.0
1980-->
1981
1982Used generically to identify that an operation caused an out of memory
1983condition.
1984
1985<a id="ERR_PARSE_HISTORY_DATA"></a>
1986### ERR_PARSE_HISTORY_DATA
1987<!-- YAML
1988added: v9.0.0
1989removed: v10.0.0
1990-->
1991
1992The `repl` module was unable to parse data from the REPL history file.
1993
1994
1995<a id="ERR_STDERR_CLOSE"></a>
1996### ERR_STDERR_CLOSE
1997<!-- YAML
1998removed: v10.12.0
1999changes:
2000  - version: v10.12.0
2001    pr-url: https://github.com/nodejs/node/pull/23053
2002    description: Rather than emitting an error, `process.stderr.end()` now
2003                 only closes the stream side but not the underlying resource,
2004                 making this error obsolete.
2005-->
2006
2007An attempt was made to close the `process.stderr` stream. By design, Node.js
2008does not allow `stdout` or `stderr` streams to be closed by user code.
2009
2010<a id="ERR_STDOUT_CLOSE"></a>
2011### ERR_STDOUT_CLOSE
2012<!-- YAML
2013removed: v10.12.0
2014changes:
2015  - version: v10.12.0
2016    pr-url: https://github.com/nodejs/node/pull/23053
2017    description: Rather than emitting an error, `process.stderr.end()` now
2018                 only closes the stream side but not the underlying resource,
2019                 making this error obsolete.
2020-->
2021
2022An attempt was made to close the `process.stdout` stream. By design, Node.js
2023does not allow `stdout` or `stderr` streams to be closed by user code.
2024
2025<a id="ERR_STREAM_READ_NOT_IMPLEMENTED"></a>
2026### ERR_STREAM_READ_NOT_IMPLEMENTED
2027<!-- YAML
2028added: v9.0.0
2029removed: v10.0.0
2030-->
2031
2032Used when an attempt is made to use a readable stream that has not implemented
2033[`readable._read()`][].
2034
2035<a id="ERR_TLS_RENEGOTIATION_FAILED"></a>
2036### ERR_TLS_RENEGOTIATION_FAILED
2037<!-- YAML
2038added: v9.0.0
2039removed: v10.0.0
2040-->
2041
2042Used when a TLS renegotiation request has failed in a non-specific way.
2043
2044<a id="ERR_UNKNOWN_BUILTIN_MODULE"></a>
2045### ERR_UNKNOWN_BUILTIN_MODULE
2046<!-- YAML
2047added: v8.0.0
2048removed: v9.0.0
2049-->
2050
2051The `'ERR_UNKNOWN_BUILTIN_MODULE'` error code is used to identify a specific
2052kind of internal Node.js error that should not typically be triggered by user
2053code. Instances of this error point to an internal bug within the Node.js
2054binary itself.
2055
2056<a id="ERR_VALUE_OUT_OF_RANGE"></a>
2057### ERR_VALUE_OUT_OF_RANGE
2058<!-- YAML
2059added: v9.0.0
2060removed: v10.0.0
2061-->
2062
2063Used when a given value is out of the accepted range.
2064
2065<a id="ERR_ZLIB_BINDING_CLOSED"></a>
2066### ERR_ZLIB_BINDING_CLOSED
2067<!-- YAML
2068added: v9.0.0
2069removed: v10.0.0
2070-->
2071
2072Used when an attempt is made to use a `zlib` object after it has already been
2073closed.
2074
2075### Other error codes
2076
2077These errors have never been released, but had been present on master between
2078releases.
2079
2080<a id="ERR_FS_WATCHER_ALREADY_STARTED"></a>
2081#### ERR_FS_WATCHER_ALREADY_STARTED
2082
2083An attempt was made to start a watcher returned by `fs.watch()` that has
2084already been started.
2085
2086<a id="ERR_FS_WATCHER_NOT_STARTED"></a>
2087#### ERR_FS_WATCHER_NOT_STARTED
2088
2089An attempt was made to initiate operations on a watcher returned by
2090`fs.watch()` that has not yet been started.
2091
2092<a id="ERR_HTTP2_ALREADY_SHUTDOWN"></a>
2093#### ERR_HTTP2_ALREADY_SHUTDOWN
2094
2095Occurs with multiple attempts to shutdown an HTTP/2 session.
2096
2097<a id="ERR_HTTP2_ERROR"></a>
2098#### ERR_HTTP2_ERROR
2099
2100A non-specific HTTP/2 error has occurred.
2101
2102<a id="ERR_INVALID_REPL_HISTORY"></a>
2103#### ERR_INVALID_REPL_HISTORY
2104
2105Used in the `repl` in case the old history file is used and an error occurred
2106while trying to read and parse it.
2107
2108<a id="ERR_MISSING_DYNAMIC_INSTANTIATE_HOOK"></a>
2109#### ERR_MISSING_DYNAMIC_INSTANTIATE_HOOK
2110
2111Used when an [ES6 module][] loader hook specifies `format: 'dynamic'` but does
2112not provide a `dynamicInstantiate` hook.
2113
2114<a id="ERR_STREAM_HAS_STRINGDECODER"></a>
2115#### ERR_STREAM_HAS_STRINGDECODER
2116
2117Used to prevent an abort if a string decoder was set on the Socket.
2118
2119```js
2120const Socket = require('net').Socket;
2121const instance = new Socket();
2122
2123instance.setEncoding('utf8');
2124```
2125
2126<a id="ERR_STRING_TOO_LARGE"></a>
2127#### ERR_STRING_TOO_LARGE
2128
2129An attempt has been made to create a string larger than the maximum allowed
2130size.
2131
2132[`'uncaughtException'`]: process.html#process_event_uncaughtexception
2133[`--force-fips`]: cli.html#cli_force_fips
2134[`Class: assert.AssertionError`]: assert.html#assert_class_assert_assertionerror
2135[`ERR_INVALID_ARG_TYPE`]: #ERR_INVALID_ARG_TYPE
2136[`EventEmitter`]: events.html#events_class_eventemitter
2137[`Writable`]: stream.html#stream_class_stream_writable
2138[`child_process`]: child_process.html
2139[`cipher.getAuthTag()`]: crypto.html#crypto_cipher_getauthtag
2140[`crypto.scrypt()`]: crypto.html#crypto_crypto_scrypt_password_salt_keylen_options_callback
2141[`crypto.scryptSync()`]: crypto.html#crypto_crypto_scryptsync_password_salt_keylen_options
2142[`crypto.timingSafeEqual()`]: crypto.html#crypto_crypto_timingsafeequal_a_b
2143[`dgram.createSocket()`]: dgram.html#dgram_dgram_createsocket_options_callback
2144[`errno`(3) man page]: http://man7.org/linux/man-pages/man3/errno.3.html
2145[`fs.readFileSync`]: fs.html#fs_fs_readfilesync_path_options
2146[`fs.readdir`]: fs.html#fs_fs_readdir_path_options_callback
2147[`fs.symlink()`]: fs.html#fs_fs_symlink_target_path_type_callback
2148[`fs.symlinkSync()`]: fs.html#fs_fs_symlinksync_target_path_type
2149[`fs.unlink`]: fs.html#fs_fs_unlink_path_callback
2150[`fs`]: fs.html
2151[`hash.digest()`]: crypto.html#crypto_hash_digest_encoding
2152[`hash.update()`]: crypto.html#crypto_hash_update_data_inputencoding
2153[`http`]: http.html
2154[`https`]: https.html
2155[`libuv Error handling`]: http://docs.libuv.org/en/v1.x/errors.html
2156[`net`]: net.html
2157[`new URL(input)`]: url.html#url_constructor_new_url_input_base
2158[`new URLSearchParams(iterable)`]: url.html#url_constructor_new_urlsearchparams_iterable
2159[`process.send()`]: process.html#process_process_send_message_sendhandle_options_callback
2160[`process.setUncaughtExceptionCaptureCallback()`]: process.html#process_process_setuncaughtexceptioncapturecallback_fn
2161[`readable._read()`]: stream.html#stream_readable_read_size_1
2162[`require('crypto').setEngine()`]: crypto.html#crypto_crypto_setengine_engine_flags
2163[`require()`]: modules.html#modules_require
2164[`server.close()`]: net.html#net_server_close_callback
2165[`server.listen()`]: net.html#net_server_listen
2166[`sign.sign()`]: crypto.html#crypto_sign_sign_privatekey_outputencoding
2167[`stream.pipe()`]: stream.html#stream_readable_pipe_destination_options
2168[`stream.push()`]: stream.html#stream_readable_push_chunk_encoding
2169[`stream.unshift()`]: stream.html#stream_readable_unshift_chunk
2170[`stream.write()`]: stream.html#stream_writable_write_chunk_encoding_callback
2171[`subprocess.kill()`]: child_process.html#child_process_subprocess_kill_signal
2172[`subprocess.send()`]: child_process.html#child_process_subprocess_send_message_sendhandle_options_callback
2173[`zlib`]: zlib.html
2174[ES6 module]: esm.html
2175[ICU]: intl.html#intl_internationalization_support
2176[Node.js Error Codes]: #nodejs-error-codes
2177[V8's stack trace API]: https://github.com/v8/v8/wiki/Stack-Trace-API
2178[WHATWG Supported Encodings]: util.html#util_whatwg_supported_encodings
2179[WHATWG URL API]: url.html#url_the_whatwg_url_api
2180[crypto digest algorithm]: crypto.html#crypto_crypto_gethashes
2181[domains]: domain.html
2182[event emitter-based]: events.html#events_class_eventemitter
2183[file descriptors]: https://en.wikipedia.org/wiki/File_descriptor
2184[stream-based]: stream.html
2185[syscall]: http://man7.org/linux/man-pages/man2/syscalls.2.html
2186[try-catch]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch
2187[vm]: vm.html
2188