{
  "source": "doc/api/errors.md",
  "introduced_in": "v4.0.0",
  "classes": [
    {
      "textRaw": "Class: Error",
      "type": "class",
      "name": "Error",
      "desc": "<p>A generic JavaScript <code>Error</code> object that does not denote any specific\ncircumstance of why the error occurred. <code>Error</code> objects capture a &quot;stack trace&quot;\ndetailing the point in the code at which the <code>Error</code> was instantiated, and may\nprovide a text description of the error.</p>\n<p>All errors generated by Node.js, including all System and JavaScript errors,\nwill either be instances of, or inherit from, the <code>Error</code> class.</p>\n",
      "methods": [
        {
          "textRaw": "Error.captureStackTrace(targetObject[, constructorOpt])",
          "type": "method",
          "name": "captureStackTrace",
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`targetObject` {Object} ",
                  "name": "targetObject",
                  "type": "Object"
                },
                {
                  "textRaw": "`constructorOpt` {Function} ",
                  "name": "constructorOpt",
                  "type": "Function",
                  "optional": true
                }
              ]
            },
            {
              "params": [
                {
                  "name": "targetObject"
                },
                {
                  "name": "constructorOpt",
                  "optional": true
                }
              ]
            }
          ],
          "desc": "<p>Creates a <code>.stack</code> property on <code>targetObject</code>, which when accessed returns\na string representing the location in the code at which\n<code>Error.captureStackTrace()</code> was called.</p>\n<pre><code class=\"lang-js\">const myObject = {};\nError.captureStackTrace(myObject);\nmyObject.stack;  // similar to `new Error().stack`\n</code></pre>\n<p>The first line of the trace will be prefixed with <code>${myObject.name}: ${myObject.message}</code>.</p>\n<p>The optional <code>constructorOpt</code> argument accepts a function. If given, all frames\nabove <code>constructorOpt</code>, including <code>constructorOpt</code>, will be omitted from the\ngenerated stack trace.</p>\n<p>The <code>constructorOpt</code> argument is useful for hiding implementation\ndetails of error generation from an end user. For instance:</p>\n<pre><code class=\"lang-js\">function MyError() {\n  Error.captureStackTrace(this, MyError);\n}\n\n// Without passing MyError to captureStackTrace, the MyError\n// frame would show up in the .stack property. By passing\n// the constructor, we omit that frame, and retain all frames below it.\nnew MyError().stack;\n</code></pre>\n"
        }
      ],
      "properties": [
        {
          "textRaw": "`stackTraceLimit` {number} ",
          "type": "number",
          "name": "stackTraceLimit",
          "desc": "<p>The <code>Error.stackTraceLimit</code> property specifies the number of stack frames\ncollected by a stack trace (whether generated by <code>new Error().stack</code> or\n<code>Error.captureStackTrace(obj)</code>).</p>\n<p>The default value is <code>10</code> but may be set to any valid JavaScript number. Changes\nwill affect any stack trace captured <em>after</em> the value has been changed.</p>\n<p>If set to a non-number value, or set to a negative number, stack traces will\nnot capture any frames.</p>\n"
        },
        {
          "textRaw": "`code` {string} ",
          "type": "string",
          "name": "code",
          "desc": "<p>The <code>error.code</code> property is a string label that identifies the kind of error.\nSee <a href=\"#nodejs-error-codes\">Node.js Error Codes</a> for details about specific codes.</p>\n"
        },
        {
          "textRaw": "`message` {string} ",
          "type": "string",
          "name": "message",
          "desc": "<p>The <code>error.message</code> property is the string description of the error as set by\ncalling <code>new Error(message)</code>. The <code>message</code> passed to the constructor will also\nappear in the first line of the stack trace of the <code>Error</code>, however changing\nthis property after the <code>Error</code> object is created <em>may not</em> change the first\nline of the stack trace (for example, when <code>error.stack</code> is read before this\nproperty is changed).</p>\n<pre><code class=\"lang-js\">const err = new Error(&#39;The message&#39;);\nconsole.error(err.message);\n// Prints: The message\n</code></pre>\n"
        },
        {
          "textRaw": "`stack` {string} ",
          "type": "string",
          "name": "stack",
          "desc": "<p>The <code>error.stack</code> property is a string describing the point in the code at which\nthe <code>Error</code> was instantiated.</p>\n<p>For example:</p>\n<pre><code class=\"lang-txt\">Error: Things keep happening!\n   at /home/gbusey/file.js:525:2\n   at Frobnicator.refrobulate (/home/gbusey/business-logic.js:424:21)\n   at Actor.&lt;anonymous&gt; (/home/gbusey/actors.js:400:8)\n   at increaseSynergy (/home/gbusey/actors.js:701:6)\n</code></pre>\n<p>The first line is formatted as <code>&lt;error class name&gt;: &lt;error message&gt;</code>, and\nis followed by a series of stack frames (each line beginning with &quot;at &quot;).\nEach frame describes a call site within the code that lead to the error being\ngenerated. V8 attempts to display a name for each function (by variable name,\nfunction name, or object method name), but occasionally it will not be able to\nfind a suitable name. If V8 cannot determine a name for the function, only\nlocation information will be displayed for that frame. Otherwise, the\ndetermined function name will be displayed with location information appended\nin parentheses.</p>\n<p>It is important to note that frames are <strong>only</strong> generated for JavaScript\nfunctions. If, for example, execution synchronously passes through a C++ addon\nfunction called <code>cheetahify</code>, which itself calls a JavaScript function, the\nframe representing the <code>cheetahify</code> call will <strong>not</strong> be present in the stack\ntraces:</p>\n<pre><code class=\"lang-js\">const cheetahify = require(&#39;./native-binding.node&#39;);\n\nfunction makeFaster() {\n  // cheetahify *synchronously* calls speedy.\n  cheetahify(function speedy() {\n    throw new Error(&#39;oh no!&#39;);\n  });\n}\n\nmakeFaster();\n// will throw:\n//   /home/gbusey/file.js:6\n//       throw new Error(&#39;oh no!&#39;);\n//           ^\n//   Error: oh no!\n//       at speedy (/home/gbusey/file.js:6:11)\n//       at makeFaster (/home/gbusey/file.js:5:3)\n//       at Object.&lt;anonymous&gt; (/home/gbusey/file.js:10:1)\n//       at Module._compile (module.js:456:26)\n//       at Object.Module._extensions..js (module.js:474:10)\n//       at Module.load (module.js:356:32)\n//       at Function.Module._load (module.js:312:12)\n//       at Function.Module.runMain (module.js:497:10)\n//       at startup (node.js:119:16)\n//       at node.js:906:3\n</code></pre>\n<p>The location information will be one of:</p>\n<ul>\n<li><code>native</code>, if the frame represents a call internal to V8 (as in <code>[].forEach</code>).</li>\n<li><code>plain-filename.js:line:column</code>, if the frame represents a call internal\n to Node.js.</li>\n<li><code>/absolute/path/to/file.js:line:column</code>, if the frame represents a call in\na user program, or its dependencies.</li>\n</ul>\n<p>The string representing the stack trace is lazily generated when the\n<code>error.stack</code> property is <strong>accessed</strong>.</p>\n<p>The number of frames captured by the stack trace is bounded by the smaller of\n<code>Error.stackTraceLimit</code> or the number of available frames on the current event\nloop tick.</p>\n<p>System-level errors are generated as augmented <code>Error</code> instances, which are\ndetailed <a href=\"#errors_system_errors\">here</a>.</p>\n"
        }
      ],
      "signatures": [
        {
          "params": [
            {
              "textRaw": "`message` {string} ",
              "name": "message",
              "type": "string"
            }
          ],
          "desc": "<p>Creates a new <code>Error</code> object and sets the <code>error.message</code> property to the\nprovided text message. If an object is passed as <code>message</code>, the text message\nis generated by calling <code>message.toString()</code>. The <code>error.stack</code> property will\nrepresent the point in the code at which <code>new Error()</code> was called. Stack traces\nare dependent on <a href=\"https://github.com/v8/v8/wiki/Stack-Trace-API\">V8&#39;s stack trace API</a>. Stack traces extend only to either\n(a) the beginning of  <em>synchronous code execution</em>, or (b) the number of frames\ngiven by the property <code>Error.stackTraceLimit</code>, whichever is smaller.</p>\n"
        },
        {
          "params": [
            {
              "name": "message"
            }
          ],
          "desc": "<p>Creates a new <code>Error</code> object and sets the <code>error.message</code> property to the\nprovided text message. If an object is passed as <code>message</code>, the text message\nis generated by calling <code>message.toString()</code>. The <code>error.stack</code> property will\nrepresent the point in the code at which <code>new Error()</code> was called. Stack traces\nare dependent on <a href=\"https://github.com/v8/v8/wiki/Stack-Trace-API\">V8&#39;s stack trace API</a>. Stack traces extend only to either\n(a) the beginning of  <em>synchronous code execution</em>, or (b) the number of frames\ngiven by the property <code>Error.stackTraceLimit</code>, whichever is smaller.</p>\n"
        }
      ]
    },
    {
      "textRaw": "Class: AssertionError",
      "type": "class",
      "name": "AssertionError",
      "desc": "<p>A subclass of <code>Error</code> that indicates the failure of an assertion. Such errors\ncommonly indicate inequality of actual and expected value.</p>\n<p>For example:</p>\n<pre><code class=\"lang-js\">assert.strictEqual(1, 2);\n// AssertionError [ERR_ASSERTION]: 1 === 2\n</code></pre>\n"
    },
    {
      "textRaw": "Class: RangeError",
      "type": "class",
      "name": "RangeError",
      "desc": "<p>A subclass of <code>Error</code> that indicates that a provided argument was not within the\nset or range of acceptable values for a function; whether that is a numeric\nrange, or outside the set of options for a given function parameter.</p>\n<p>For example:</p>\n<pre><code class=\"lang-js\">require(&#39;net&#39;).connect(-1);\n// throws &quot;RangeError: &quot;port&quot; option should be &gt;= 0 and &lt; 65536: -1&quot;\n</code></pre>\n<p>Node.js will generate and throw <code>RangeError</code> instances <em>immediately</em> as a form\nof argument validation.</p>\n"
    },
    {
      "textRaw": "Class: ReferenceError",
      "type": "class",
      "name": "ReferenceError",
      "desc": "<p>A subclass of <code>Error</code> that indicates that an attempt is being made to access a\nvariable that is not defined. Such errors commonly indicate typos in code, or\nan otherwise broken program.</p>\n<p>While client code may generate and propagate these errors, in practice, only V8\nwill do so.</p>\n<pre><code class=\"lang-js\">doesNotExist;\n// throws ReferenceError, doesNotExist is not a variable in this program.\n</code></pre>\n<p>Unless an application is dynamically generating and running code,\n<code>ReferenceError</code> instances should always be considered a bug in the code\nor its dependencies.</p>\n"
    },
    {
      "textRaw": "Class: SyntaxError",
      "type": "class",
      "name": "SyntaxError",
      "desc": "<p>A subclass of <code>Error</code> that indicates that a program is not valid JavaScript.\nThese errors may only be generated and propagated as a result of code\nevaluation. Code evaluation may happen as a result of <code>eval</code>, <code>Function</code>,\n<code>require</code>, or <a href=\"vm.html\">vm</a>. These errors are almost always indicative of a broken\nprogram.</p>\n<pre><code class=\"lang-js\">try {\n  require(&#39;vm&#39;).runInThisContext(&#39;binary ! isNotOk&#39;);\n} catch (err) {\n  // err will be a SyntaxError\n}\n</code></pre>\n<p><code>SyntaxError</code> instances are unrecoverable in the context that created them –\nthey may only be caught by other contexts.</p>\n"
    },
    {
      "textRaw": "Class: TypeError",
      "type": "class",
      "name": "TypeError",
      "desc": "<p>A subclass of <code>Error</code> that indicates that a provided argument is not an\nallowable type. For example, passing a function to a parameter which expects a\nstring would be considered a TypeError.</p>\n<pre><code class=\"lang-js\">require(&#39;url&#39;).parse(() =&gt; { });\n// throws TypeError, since it expected a string\n</code></pre>\n<p>Node.js will generate and throw <code>TypeError</code> instances <em>immediately</em> as a form\nof argument validation.</p>\n"
    }
  ],
  "miscs": [
    {
      "textRaw": "Errors",
      "name": "Errors",
      "introduced_in": "v4.0.0",
      "type": "misc",
      "desc": "<p>Applications running in Node.js will generally experience four categories of\nerrors:</p>\n<ul>\n<li>Standard JavaScript errors such as:<ul>\n<li>{EvalError} : thrown when a call to <code>eval()</code> fails.</li>\n<li>{SyntaxError} : thrown in response to improper JavaScript language\nsyntax.</li>\n<li>{RangeError} : thrown when a value is not within an expected range</li>\n<li>{ReferenceError} : thrown when using undefined variables</li>\n<li>{TypeError} : thrown when passing arguments of the wrong type</li>\n<li>{URIError} : thrown when a global URI handling function is misused.</li>\n</ul>\n</li>\n<li>System errors triggered by underlying operating system constraints such\nas attempting to open a file that does not exist, attempting to send data\nover a closed socket, etc;</li>\n<li>And User-specified errors triggered by application code.</li>\n<li>Assertion Errors are a special class of error that can be triggered whenever\nNode.js detects an exceptional logic violation that should never occur. These\nare raised typically by the <code>assert</code> module.</li>\n</ul>\n<p>All JavaScript and System errors raised by Node.js inherit from, or are\ninstances of, the standard JavaScript {Error} class and are guaranteed\nto provide <em>at least</em> the properties available on that class.</p>\n",
      "miscs": [
        {
          "textRaw": "Error Propagation and Interception",
          "name": "Error Propagation and Interception",
          "type": "misc",
          "desc": "<p>Node.js supports several mechanisms for propagating and handling errors that\noccur while an application is running. How these errors are reported and\nhandled depends entirely on the type of Error and the style of the API that is\ncalled.</p>\n<p>All JavaScript errors are handled as exceptions that <em>immediately</em> generate\nand throw an error using the standard JavaScript <code>throw</code> mechanism. These\nare handled using the <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch\"><code>try / catch</code> construct</a> provided by the\nJavaScript language.</p>\n<pre><code class=\"lang-js\">// Throws with a ReferenceError because z is undefined\ntry {\n  const m = 1;\n  const n = m + z;\n} catch (err) {\n  // Handle the error here.\n}\n</code></pre>\n<p>Any use of the JavaScript <code>throw</code> mechanism will raise an exception that\n<em>must</em> be handled using <code>try / catch</code> or the Node.js process will exit\nimmediately.</p>\n<p>With few exceptions, <em>Synchronous</em> APIs (any blocking method that does not\naccept a <code>callback</code> function, such as <a href=\"fs.html#fs_fs_readfilesync_path_options\"><code>fs.readFileSync</code></a>), will use <code>throw</code>\nto report errors.</p>\n<p>Errors that occur within <em>Asynchronous APIs</em> may be reported in multiple ways:</p>\n<ul>\n<li>Most asynchronous methods that accept a <code>callback</code> function will accept an\n<code>Error</code> object passed as the first argument to that function. If that first\nargument is not <code>null</code> and is an instance of <code>Error</code>, then an error occurred\nthat should be handled.</li>\n</ul>\n<!-- eslint-disable no-useless-return -->\n<pre><code class=\"lang-js\">  const fs = require(&#39;fs&#39;);\n  fs.readFile(&#39;a file that does not exist&#39;, (err, data) =&gt; {\n    if (err) {\n      console.error(&#39;There was an error reading the file!&#39;, err);\n      return;\n    }\n    // Otherwise handle the data\n  });\n</code></pre>\n<ul>\n<li><p>When an asynchronous method is called on an object that is an <code>EventEmitter</code>,\nerrors can be routed to that object&#39;s <code>&#39;error&#39;</code> event.</p>\n<pre><code class=\"lang-js\">const net = require(&#39;net&#39;);\nconst connection = net.connect(&#39;localhost&#39;);\n\n// Adding an &#39;error&#39; event handler to a stream:\nconnection.on(&#39;error&#39;, (err) =&gt; {\n  // If the connection is reset by the server, or if it can&#39;t\n  // connect at all, or on any sort of error encountered by\n  // the connection, the error will be sent here.\n  console.error(err);\n});\n\nconnection.pipe(process.stdout);\n</code></pre>\n</li>\n<li><p>A handful of typically asynchronous methods in the Node.js API may still\nuse the <code>throw</code> mechanism to raise exceptions that must be handled using\n<code>try / catch</code>. There is no comprehensive list of such methods; please\nrefer to the documentation of each method to determine the appropriate\nerror handling mechanism required.</p>\n</li>\n</ul>\n<p>The use of the <code>&#39;error&#39;</code> event mechanism is most common for <a href=\"stream.html\">stream-based</a>\nand <a href=\"events.html#events_class_eventemitter\">event emitter-based</a> APIs, which themselves represent a series of\nasynchronous operations over time (as opposed to a single operation that may\npass or fail).</p>\n<p>For <em>all</em> <code>EventEmitter</code> objects, if an <code>&#39;error&#39;</code> event handler is not\nprovided, the error will be thrown, causing the Node.js process to report an\nunhandled exception and  crash unless either: The <a href=\"domain.html\"><code>domain</code></a> module is\nused appropriately or a handler has been registered for the\n<a href=\"process.html#process_event_uncaughtexception\"><code>process.on(&#39;uncaughtException&#39;)</code></a> event.</p>\n<pre><code class=\"lang-js\">const EventEmitter = require(&#39;events&#39;);\nconst ee = new EventEmitter();\n\nsetImmediate(() =&gt; {\n  // This will crash the process because no &#39;error&#39; event\n  // handler has been added.\n  ee.emit(&#39;error&#39;, new Error(&#39;This will crash&#39;));\n});\n</code></pre>\n<p>Errors generated in this way <em>cannot</em> be intercepted using <code>try / catch</code> as\nthey are thrown <em>after</em> the calling code has already exited.</p>\n<p>Developers must refer to the documentation for each method to determine\nexactly how errors raised by those methods are propagated.</p>\n",
          "miscs": [
            {
              "textRaw": "Node.js style callbacks",
              "name": "Node.js style callbacks",
              "type": "misc",
              "desc": "<p>Most asynchronous methods exposed by the Node.js core API follow an idiomatic\npattern  referred to as a &quot;Node.js style callback&quot;. With this pattern, a\ncallback function is passed to the method as an argument. When the operation\neither completes or an error is raised, the callback function is called with\nthe Error object (if any) passed as the first argument. If no error was raised,\nthe first argument will be passed as <code>null</code>.</p>\n<pre><code class=\"lang-js\">const fs = require(&#39;fs&#39;);\n\nfunction nodeStyleCallback(err, data) {\n  if (err) {\n    console.error(&#39;There was an error&#39;, err);\n    return;\n  }\n  console.log(data);\n}\n\nfs.readFile(&#39;/some/file/that/does-not-exist&#39;, nodeStyleCallback);\nfs.readFile(&#39;/some/file/that/does-exist&#39;, nodeStyleCallback);\n</code></pre>\n<p>The JavaScript <code>try / catch</code> mechanism <strong>cannot</strong> be used to intercept errors\ngenerated by asynchronous APIs.  A common mistake for beginners is to try to\nuse <code>throw</code> inside a Node.js style callback:</p>\n<pre><code class=\"lang-js\">// THIS WILL NOT WORK:\nconst fs = require(&#39;fs&#39;);\n\ntry {\n  fs.readFile(&#39;/some/file/that/does-not-exist&#39;, (err, data) =&gt; {\n    // mistaken assumption: throwing here...\n    if (err) {\n      throw err;\n    }\n  });\n} catch (err) {\n  // This will not catch the throw!\n  console.error(err);\n}\n</code></pre>\n<p>This will not work because the callback function passed to <code>fs.readFile()</code> is\ncalled asynchronously. By the time the callback has been called, the\nsurrounding code (including the <code>try { } catch (err) { }</code> block will have\nalready exited. Throwing an error inside the callback <strong>can crash the Node.js\nprocess</strong> in most cases. If <a href=\"domain.html\">domains</a> are enabled, or a handler has been\nregistered with <code>process.on(&#39;uncaughtException&#39;)</code>, such errors can be\nintercepted.</p>\n"
            }
          ]
        },
        {
          "textRaw": "Exceptions vs. Errors",
          "name": "Exceptions vs. Errors",
          "type": "misc",
          "desc": "<p>A JavaScript exception is a value that is thrown as a result of an invalid\noperation or as the target of a <code>throw</code> statement. While it is not required\nthat these values are instances of <code>Error</code> or classes which inherit from\n<code>Error</code>, all exceptions thrown by Node.js or the JavaScript runtime <em>will</em> be\ninstances of Error.</p>\n<p>Some exceptions are <em>unrecoverable</em> at the JavaScript layer. Such exceptions\nwill <em>always</em> cause the Node.js process to crash. Examples include <code>assert()</code>\nchecks or <code>abort()</code> calls in the C++ layer.</p>\n"
        },
        {
          "textRaw": "System Errors",
          "name": "system_errors",
          "desc": "<p>System errors are generated when exceptions occur within the program&#39;s\nruntime environment. Typically, these are operational errors that occur\nwhen an application violates an operating system constraint such as attempting\nto read a file that does not exist or when the user does not have sufficient\npermissions.</p>\n<p>System errors are typically generated at the syscall level: an exhaustive list\nof error codes and their meanings is available by running <code>man 2 intro</code> or\n<code>man 3 errno</code> on most Unices; or <a href=\"http://man7.org/linux/man-pages/man3/errno.3.html\">online</a>.</p>\n<p>In Node.js, system errors are represented as augmented <code>Error</code> objects with\nadded properties.</p>\n",
          "classes": [
            {
              "textRaw": "Class: System Error",
              "type": "class",
              "name": "System",
              "properties": [
                {
                  "textRaw": "`code` {string} ",
                  "type": "string",
                  "name": "code",
                  "desc": "<p>The <code>error.code</code> property is a string representing the error code, which is\ntypically <code>E</code> followed by a sequence of capital letters.</p>\n"
                },
                {
                  "textRaw": "`errno` {string|number} ",
                  "type": "string|number",
                  "name": "errno",
                  "desc": "<p>The <code>error.errno</code> property is a number or a string.\nThe number is a <strong>negative</strong> value which corresponds to the error code defined\nin <a href=\"http://docs.libuv.org/en/v1.x/errors.html\"><code>libuv Error handling</code></a>. See uv-errno.h header file\n(<code>deps/uv/include/uv-errno.h</code> in the Node.js source tree) for details. In case\nof a string, it is the same as <code>error.code</code>.</p>\n"
                },
                {
                  "textRaw": "`syscall` {string} ",
                  "type": "string",
                  "name": "syscall",
                  "desc": "<p>The <code>error.syscall</code> property is a string describing the <a href=\"http://man7.org/linux/man-pages/man2/syscall.2.html\">syscall</a> that failed.</p>\n"
                },
                {
                  "textRaw": "`path` {string} ",
                  "type": "string",
                  "name": "path",
                  "desc": "<p>When present (e.g. in <code>fs</code> or <code>child_process</code>), the <code>error.path</code> property is a\nstring containing a relevant invalid pathname.</p>\n"
                },
                {
                  "textRaw": "`address` {string} ",
                  "type": "string",
                  "name": "address",
                  "desc": "<p>When present (e.g. in <code>net</code> or <code>dgram</code>), the <code>error.address</code> property is a\nstring describing the address to which the connection failed.</p>\n"
                },
                {
                  "textRaw": "`port` {number} ",
                  "type": "number",
                  "name": "port",
                  "desc": "<p>When present (e.g. in <code>net</code> or <code>dgram</code>), the <code>error.port</code> property is a number\nrepresenting the connection&#39;s port that is not available.</p>\n"
                }
              ]
            }
          ],
          "modules": [
            {
              "textRaw": "Common System Errors",
              "name": "common_system_errors",
              "desc": "<p>This list is <strong>not exhaustive</strong>, but enumerates many of the common system\nerrors encountered when writing a Node.js program. An exhaustive list may be\nfound <a href=\"http://man7.org/linux/man-pages/man3/errno.3.html\">here</a>.</p>\n<ul>\n<li><p><code>EACCES</code> (Permission denied): An attempt was made to access a file in a way\nforbidden by its file access permissions.</p>\n</li>\n<li><p><code>EADDRINUSE</code> (Address already in use):  An attempt to bind a server\n(<a href=\"net.html\"><code>net</code></a>, <a href=\"http.html\"><code>http</code></a>, or <a href=\"https.html\"><code>https</code></a>) to a local address failed due to\nanother server on the local system already occupying that address.</p>\n</li>\n<li><p><code>ECONNREFUSED</code> (Connection refused): No connection could be made because the\ntarget machine actively refused it. This usually results from trying to\nconnect to a service that is inactive on the foreign host.</p>\n</li>\n<li><p><code>ECONNRESET</code> (Connection reset by peer): A connection was forcibly closed by\na peer. This normally results from a loss of the connection on the remote\nsocket due to a timeout or reboot. Commonly encountered via the <a href=\"http.html\"><code>http</code></a>\nand <a href=\"net.html\"><code>net</code></a> modules.</p>\n</li>\n<li><p><code>EEXIST</code> (File exists): An existing file was the target of an operation that\nrequired that the target not exist.</p>\n</li>\n<li><p><code>EISDIR</code> (Is a directory): An operation expected a file, but the given\npathname was a directory.</p>\n</li>\n<li><p><code>EMFILE</code> (Too many open files in system): Maximum number of\n<a href=\"https://en.wikipedia.org/wiki/File_descriptor\">file descriptors</a> allowable on the system has been reached, and\nrequests for another descriptor cannot be fulfilled until at least one\nhas been closed. This is encountered when opening many files at once in\nparallel, especially on systems (in particular, macOS) where there is a low\nfile descriptor limit for processes. To remedy a low limit, run\n<code>ulimit -n 2048</code> in the same shell that will run the Node.js process.</p>\n</li>\n<li><p><code>ENOENT</code> (No such file or directory): Commonly raised by <a href=\"fs.html\"><code>fs</code></a> operations\nto indicate that a component of the specified pathname does not exist -- no\nentity (file or directory) could be found by the given path.</p>\n</li>\n<li><p><code>ENOTDIR</code> (Not a directory): A component of the given pathname existed, but\nwas not a directory as expected. Commonly raised by <a href=\"fs.html#fs_fs_readdir_path_options_callback\"><code>fs.readdir</code></a>.</p>\n</li>\n<li><p><code>ENOTEMPTY</code> (Directory not empty): A directory with entries was the target\nof an operation that requires an empty directory -- usually <a href=\"fs.html#fs_fs_unlink_path_callback\"><code>fs.unlink</code></a>.</p>\n</li>\n<li><p><code>EPERM</code> (Operation not permitted): An attempt was made to perform an\noperation that requires elevated privileges.</p>\n</li>\n<li><p><code>EPIPE</code> (Broken pipe): A write on a pipe, socket, or FIFO for which there is\nno process to read the data. Commonly encountered at the <a href=\"net.html\"><code>net</code></a> and\n<a href=\"http.html\"><code>http</code></a> layers, indicative that the remote side of the stream being\nwritten to has been closed.</p>\n</li>\n<li><p><code>ETIMEDOUT</code> (Operation timed out): A connect or send request failed because\nthe connected party did not properly respond after a period of time. Usually\nencountered by <a href=\"http.html\"><code>http</code></a> or <a href=\"net.html\"><code>net</code></a> -- often a sign that a <code>socket.end()</code>\nwas not properly called.</p>\n</li>\n</ul>\n<p><a id=\"nodejs-error-codes\"></a></p>\n",
              "type": "module",
              "displayName": "Common System Errors"
            }
          ],
          "type": "misc",
          "displayName": "System Errors"
        },
        {
          "textRaw": "Node.js Error Codes",
          "name": "node.js_error_codes",
          "desc": "<p><a id=\"ERR_ARG_NOT_ITERABLE\"></a></p>\n",
          "modules": [
            {
              "textRaw": "ERR_ARG_NOT_ITERABLE",
              "name": "err_arg_not_iterable",
              "desc": "<p>Used generically to identify that an iterable argument (i.e. a value that works\nwith <code>for...of</code> loops) is required, but not provided to a Node.js API.</p>\n<p><a id=\"ERR_FALSY_VALUE_REJECTION\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_ARG_NOT_ITERABLE"
            },
            {
              "textRaw": "ERR_FALSY_VALUE_REJECTION",
              "name": "err_falsy_value_rejection",
              "desc": "<p>Used by the <code>util.callbackify()</code> API when a callbackified <code>Promise</code> is rejected\nwith a falsy value (e.g. <code>null</code>).</p>\n<p><a id=\"ERR_HTTP_HEADERS_SENT\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_FALSY_VALUE_REJECTION"
            },
            {
              "textRaw": "ERR_HTTP_HEADERS_SENT",
              "name": "err_http_headers_sent",
              "desc": "<p>Used when headers have already been sent and another attempt is made to add\nmore headers.</p>\n<p><a id=\"ERR_HTTP_INVALID_STATUS_CODE\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP_HEADERS_SENT"
            },
            {
              "textRaw": "ERR_HTTP_INVALID_STATUS_CODE",
              "name": "err_http_invalid_status_code",
              "desc": "<p>Used for status codes outside the regular status code ranges (100-999).</p>\n<p><a id=\"ERR_HTTP_TRAILER_INVALID\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP_INVALID_STATUS_CODE"
            },
            {
              "textRaw": "ERR_HTTP_TRAILER_INVALID",
              "name": "err_http_trailer_invalid",
              "desc": "<p>Used when the <code>Trailer</code> header is set even though the transfer encoding does not\nsupport that.</p>\n<p><a id=\"ERR_HTTP2_CONNECT_AUTHORITY\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP_TRAILER_INVALID"
            },
            {
              "textRaw": "ERR_HTTP2_CONNECT_AUTHORITY",
              "name": "err_http2_connect_authority",
              "desc": "<p>For HTTP/2 requests using the <code>CONNECT</code> method, the <code>:authority</code> pseudo-header\nis required.</p>\n<p><a id=\"ERR_HTTP2_CONNECT_PATH\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_CONNECT_AUTHORITY"
            },
            {
              "textRaw": "ERR_HTTP2_CONNECT_PATH",
              "name": "err_http2_connect_path",
              "desc": "<p>For HTTP/2 requests using the <code>CONNECT</code> method, the <code>:path</code> pseudo-header is\nforbidden.</p>\n<p><a id=\"ERR_HTTP2_CONNECT_SCHEME\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_CONNECT_PATH"
            },
            {
              "textRaw": "ERR_HTTP2_CONNECT_SCHEME",
              "name": "err_http2_connect_scheme",
              "desc": "<p>The HTTP/2 requests using the <code>CONNECT</code> method, the <code>:scheme</code> pseudo-header is\nforbidden.</p>\n<p><a id=\"ERR_HTTP2_ERROR\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_CONNECT_SCHEME"
            },
            {
              "textRaw": "ERR_HTTP2_ERROR",
              "name": "err_http2_error",
              "desc": "<p>A non-specific HTTP/2 error has occurred.</p>\n<p><a id=\"ERR_HTTP2_FRAME_ERROR\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_ERROR"
            },
            {
              "textRaw": "ERR_HTTP2_FRAME_ERROR",
              "name": "err_http2_frame_error",
              "desc": "<p>Used when a failure occurs sending an individual frame on the HTTP/2\nsession.</p>\n<p><a id=\"ERR_HTTP2_HEADERS_OBJECT\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_FRAME_ERROR"
            },
            {
              "textRaw": "ERR_HTTP2_HEADERS_OBJECT",
              "name": "err_http2_headers_object",
              "desc": "<p>Used when an HTTP/2 Headers Object is expected.</p>\n<p><a id=\"ERR_HTTP2_HEADERS_SENT\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_HEADERS_OBJECT"
            },
            {
              "textRaw": "ERR_HTTP2_HEADERS_SENT",
              "name": "err_http2_headers_sent",
              "desc": "<p>Used when an attempt is made to send multiple response headers.</p>\n<p><a id=\"ERR_HTTP2_HEADER_SINGLE_VALUE\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_HEADERS_SENT"
            },
            {
              "textRaw": "ERR_HTTP2_HEADER_SINGLE_VALUE",
              "name": "err_http2_header_single_value",
              "desc": "<p>Used when multiple values have been provided for an HTTP header field that\nrequired to have only a single value.</p>\n<p><a id=\"ERR_HTTP2_INFO_HEADERS_AFTER_RESPOND\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_HEADER_SINGLE_VALUE"
            },
            {
              "textRaw": "ERR_HTTP2_INFO_HEADERS_AFTER_RESPOND",
              "name": "err_http2_info_headers_after_respond",
              "desc": "<p>HTTP/2 Informational headers must only be sent <em>prior</em> to calling the\n<code>Http2Stream.prototype.respond()</code> method.</p>\n<p><a id=\"ERR_HTTP2_INFO_STATUS_NOT_ALLOWED\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_INFO_HEADERS_AFTER_RESPOND"
            },
            {
              "textRaw": "ERR_HTTP2_INFO_STATUS_NOT_ALLOWED",
              "name": "err_http2_info_status_not_allowed",
              "desc": "<p>Informational HTTP status codes (<code>1xx</code>) may not be set as the response status\ncode on HTTP/2 responses.</p>\n<p><a id=\"ERR_HTTP2_INVALID_CONNECTION_HEADERS\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_INFO_STATUS_NOT_ALLOWED"
            },
            {
              "textRaw": "ERR_HTTP2_INVALID_CONNECTION_HEADERS",
              "name": "err_http2_invalid_connection_headers",
              "desc": "<p>HTTP/1 connection specific headers are forbidden to be used in HTTP/2\nrequests and responses.</p>\n<p><a id=\"ERR_HTTP2_INVALID_HEADER_VALUE\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_INVALID_CONNECTION_HEADERS"
            },
            {
              "textRaw": "ERR_HTTP2_INVALID_HEADER_VALUE",
              "name": "err_http2_invalid_header_value",
              "desc": "<p>Used to indicate that an invalid HTTP/2 header value has been specified.</p>\n<p><a id=\"ERR_HTTP2_INVALID_INFO_STATUS\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_INVALID_HEADER_VALUE"
            },
            {
              "textRaw": "ERR_HTTP2_INVALID_INFO_STATUS",
              "name": "err_http2_invalid_info_status",
              "desc": "<p>An invalid HTTP informational status code has been specified. Informational\nstatus codes must be an integer between <code>100</code> and <code>199</code> (inclusive).</p>\n<p><a id=\"ERR_HTTP2_INVALID_PACKED_SETTINGS_LENGTH\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_INVALID_INFO_STATUS"
            },
            {
              "textRaw": "ERR_HTTP2_INVALID_PACKED_SETTINGS_LENGTH",
              "name": "err_http2_invalid_packed_settings_length",
              "desc": "<p>Input <code>Buffer</code> and <code>Uint8Array</code> instances passed to the\n<code>http2.getUnpackedSettings()</code> API must have a length that is a multiple of\nsix.</p>\n<p><a id=\"ERR_HTTP2_INVALID_PSEUDOHEADER\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_INVALID_PACKED_SETTINGS_LENGTH"
            },
            {
              "textRaw": "ERR_HTTP2_INVALID_PSEUDOHEADER",
              "name": "err_http2_invalid_pseudoheader",
              "desc": "<p>Only valid HTTP/2 pseudoheaders (<code>:status</code>, <code>:path</code>, <code>:authority</code>, <code>:scheme</code>,\nand <code>:method</code>) may be used.</p>\n<p><a id=\"ERR_HTTP2_INVALID_SESSION\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_INVALID_PSEUDOHEADER"
            },
            {
              "textRaw": "ERR_HTTP2_INVALID_SESSION",
              "name": "err_http2_invalid_session",
              "desc": "<p>Used when any action is performed on an <code>Http2Session</code> object that has already\nbeen destroyed.</p>\n<p><a id=\"ERR_HTTP2_INVALID_SETTING_VALUE\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_INVALID_SESSION"
            },
            {
              "textRaw": "ERR_HTTP2_INVALID_SETTING_VALUE",
              "name": "err_http2_invalid_setting_value",
              "desc": "<p>An invalid value has been specified for an HTTP/2 setting.</p>\n<p><a id=\"ERR_HTTP2_INVALID_STREAM\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_INVALID_SETTING_VALUE"
            },
            {
              "textRaw": "ERR_HTTP2_INVALID_STREAM",
              "name": "err_http2_invalid_stream",
              "desc": "<p>Used when an operation has been performed on a stream that has already been\ndestroyed.</p>\n<p><a id=\"ERR_HTTP2_MAX_PENDING_SETTINGS_ACK\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_INVALID_STREAM"
            },
            {
              "textRaw": "ERR_HTTP2_MAX_PENDING_SETTINGS_ACK",
              "name": "err_http2_max_pending_settings_ack",
              "desc": "<p>Whenever an HTTP/2 <code>SETTINGS</code> frame is sent to a connected peer, the peer is\nrequired to send an acknowledgement that it has received and applied the new\nSETTINGS. By default, a maximum number of un-acknowledged <code>SETTINGS</code> frame may\nbe sent at any given time. This error code is used when that limit has been\nreached.</p>\n<p><a id=\"ERR_HTTP2_OUT_OF_STREAMS\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_MAX_PENDING_SETTINGS_ACK"
            },
            {
              "textRaw": "ERR_HTTP2_OUT_OF_STREAMS",
              "name": "err_http2_out_of_streams",
              "desc": "<p>Used when the maximum number of streams on a single HTTP/2 session have been\ncreated.</p>\n<p><a id=\"ERR_HTTP2_PAYLOAD_FORBIDDEN\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_OUT_OF_STREAMS"
            },
            {
              "textRaw": "ERR_HTTP2_PAYLOAD_FORBIDDEN",
              "name": "err_http2_payload_forbidden",
              "desc": "<p>Used when a message payload is specified for an HTTP response code for which\na payload is forbidden.</p>\n<p><a id=\"ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_PAYLOAD_FORBIDDEN"
            },
            {
              "textRaw": "ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED",
              "name": "err_http2_pseudoheader_not_allowed",
              "desc": "<p>Used to indicate that an HTTP/2 pseudo-header has been used inappropriately.\nPseudo-headers are header key names that begin with the <code>:</code> prefix.</p>\n<p><a id=\"ERR_HTTP2_PUSH_DISABLED\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED"
            },
            {
              "textRaw": "ERR_HTTP2_PUSH_DISABLED",
              "name": "err_http2_push_disabled",
              "desc": "<p>Used when push streams have been disabled by the client but an attempt to\ncreate a push stream is made.</p>\n<p><a id=\"ERR_HTTP2_SEND_FILE\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_PUSH_DISABLED"
            },
            {
              "textRaw": "ERR_HTTP2_SEND_FILE",
              "name": "err_http2_send_file",
              "desc": "<p>Used when an attempt is made to use the\n<code>Http2Stream.prototype.responseWithFile()</code> API to send a non-regular file.</p>\n<p><a id=\"ERR_HTTP2_SOCKET_BOUND\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_SEND_FILE"
            },
            {
              "textRaw": "ERR_HTTP2_SOCKET_BOUND",
              "name": "err_http2_socket_bound",
              "desc": "<p>Used when an attempt is made to connect a <code>Http2Session</code> object to a\n<code>net.Socket</code> or <code>tls.TLSSocket</code> that has already been bound to another\n<code>Http2Session</code> object.</p>\n<p><a id=\"ERR_HTTP2_STATUS_101\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_SOCKET_BOUND"
            },
            {
              "textRaw": "ERR_HTTP2_STATUS_101",
              "name": "err_http2_status_101",
              "desc": "<p>Use of the <code>101</code> Informational status code is forbidden in HTTP/2.</p>\n<p><a id=\"ERR_HTTP2_STATUS_INVALID\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_STATUS_101"
            },
            {
              "textRaw": "ERR_HTTP2_STATUS_INVALID",
              "name": "err_http2_status_invalid",
              "desc": "<p>An invalid HTTP status code has been specified. Status codes must be an integer\nbetween <code>100</code> and <code>599</code> (inclusive).</p>\n<p><a id=\"ERR_HTTP2_STREAM_CLOSED\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_STATUS_INVALID"
            },
            {
              "textRaw": "ERR_HTTP2_STREAM_CLOSED",
              "name": "err_http2_stream_closed",
              "desc": "<p>Used when an action has been performed on an HTTP/2 Stream that has already\nbeen closed.</p>\n<p><a id=\"ERR_HTTP2_STREAM_ERROR\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_STREAM_CLOSED"
            },
            {
              "textRaw": "ERR_HTTP2_STREAM_ERROR",
              "name": "err_http2_stream_error",
              "desc": "<p>Used when a non-zero error code has been specified in an <code>RST_STREAM</code> frame.</p>\n<p><a id=\"ERR_HTTP2_STREAM_SELF_DEPENDENCY\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_STREAM_ERROR"
            },
            {
              "textRaw": "ERR_HTTP2_STREAM_SELF_DEPENDENCY",
              "name": "err_http2_stream_self_dependency",
              "desc": "<p>When setting the priority for an HTTP/2 stream, the stream may be marked as\na dependency for a parent stream. This error code is used when an attempt is\nmade to mark a stream and dependent of itself.</p>\n<p><a id=\"ERR_HTTP2_UNSUPPORTED_PROTOCOL\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_STREAM_SELF_DEPENDENCY"
            },
            {
              "textRaw": "ERR_HTTP2_UNSUPPORTED_PROTOCOL",
              "name": "err_http2_unsupported_protocol",
              "desc": "<p>Used when <code>http2.connect()</code> is passed a URL that uses any protocol other than\n<code>http:</code> or <code>https:</code>.</p>\n<p><a id=\"ERR_INDEX_OUT_OF_RANGE\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_HTTP2_UNSUPPORTED_PROTOCOL"
            },
            {
              "textRaw": "ERR_INDEX_OUT_OF_RANGE",
              "name": "err_index_out_of_range",
              "desc": "<p>Used when a given index is out of the accepted range (e.g. negative offsets).</p>\n<p><a id=\"ERR_INVALID_ARG_TYPE\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_INDEX_OUT_OF_RANGE"
            },
            {
              "textRaw": "ERR_INVALID_ARG_TYPE",
              "name": "err_invalid_arg_type",
              "desc": "<p>Used generically to identify that an argument of the wrong type has been passed\nto a Node.js API.</p>\n<p><a id=\"ERR_INVALID_CALLBACK\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_INVALID_ARG_TYPE"
            },
            {
              "textRaw": "ERR_INVALID_CALLBACK",
              "name": "err_invalid_callback",
              "desc": "<p>Used generically to identify that a callback function is required and has not\nbeen provided to a Node.js API.</p>\n<p><a id=\"ERR_INVALID_FILE_URL_HOST\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_INVALID_CALLBACK"
            },
            {
              "textRaw": "ERR_INVALID_FILE_URL_HOST",
              "name": "err_invalid_file_url_host",
              "desc": "<p>Used when a Node.js API that consumes <code>file:</code> URLs (such as certain functions in\nthe <a href=\"fs.html\"><code>fs</code></a> module) encounters a file URL with an incompatible host. Currently,\nthis situation can only occur on Unix-like systems, where only <code>localhost</code> or an\nempty host is supported.</p>\n<p><a id=\"ERR_INVALID_FILE_URL_PATH\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_INVALID_FILE_URL_HOST"
            },
            {
              "textRaw": "ERR_INVALID_FILE_URL_PATH",
              "name": "err_invalid_file_url_path",
              "desc": "<p>Used when a Node.js API that consumes <code>file:</code> URLs (such as certain\nfunctions in the <a href=\"fs.html\"><code>fs</code></a> module) encounters a file URL with an incompatible\npath. The exact semantics for determining whether a path can be used is\nplatform-dependent.</p>\n<p><a id=\"ERR_INVALID_HANDLE_TYPE\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_INVALID_FILE_URL_PATH"
            },
            {
              "textRaw": "ERR_INVALID_HANDLE_TYPE",
              "name": "err_invalid_handle_type",
              "desc": "<p>Used when an attempt is made to send an unsupported &quot;handle&quot; over an IPC\ncommunication channel to a child process. See <a href=\"child_process.html#child_process_subprocess_send_message_sendhandle_options_callback\"><code>subprocess.send()</code></a> and\n<a href=\"process.html#process_process_send_message_sendhandle_options_callback\"><code>process.send()</code></a> for more information.</p>\n<p><a id=\"ERR_INVALID_OPT_VALUE\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_INVALID_HANDLE_TYPE"
            },
            {
              "textRaw": "ERR_INVALID_OPT_VALUE",
              "name": "err_invalid_opt_value",
              "desc": "<p>Used generically to identify when an invalid or unexpected value has been\npassed in an options object.</p>\n<p><a id=\"ERR_INVALID_PROTOCOL\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_INVALID_OPT_VALUE"
            },
            {
              "textRaw": "ERR_INVALID_PROTOCOL",
              "name": "err_invalid_protocol",
              "desc": "<p>Used when an invalid <code>options.protocol</code> is passed.</p>\n<p><a id=\"ERR_INVALID_SYNC_FORK_INPUT\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_INVALID_PROTOCOL"
            },
            {
              "textRaw": "ERR_INVALID_SYNC_FORK_INPUT",
              "name": "err_invalid_sync_fork_input",
              "desc": "<p>Used when a <code>Buffer</code>, <code>Uint8Array</code> or <code>string</code> is provided as stdio input to a\nsynchronous fork. See the documentation for the\n<a href=\"child_process.html\"><code>child_process</code></a> module for more information.</p>\n<p><a id=\"ERR_INVALID_THIS\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_INVALID_SYNC_FORK_INPUT"
            },
            {
              "textRaw": "ERR_INVALID_THIS",
              "name": "err_invalid_this",
              "desc": "<p>Used generically to identify that a Node.js API function is called with an\nincompatible <code>this</code> value.</p>\n<p>Example:</p>\n<pre><code class=\"lang-js\">const { URLSearchParams } = require(&#39;url&#39;);\nconst urlSearchParams = new URLSearchParams(&#39;foo=bar&amp;baz=new&#39;);\n\nconst buf = Buffer.alloc(1);\nurlSearchParams.has.call(buf, &#39;foo&#39;);\n// Throws a TypeError with code &#39;ERR_INVALID_THIS&#39;\n</code></pre>\n<p><a id=\"ERR_INVALID_TUPLE\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_INVALID_THIS"
            },
            {
              "textRaw": "ERR_INVALID_TUPLE",
              "name": "err_invalid_tuple",
              "desc": "<p>Used when an element in the <code>iterable</code> provided to the <a href=\"url.html#url_the_whatwg_url_api\">WHATWG</a> <a href=\"url.html#url_constructor_new_urlsearchparams_iterable\"><code>URLSearchParams</code> constructor</a> does not\nrepresent a <code>[name, value]</code> tuple – that is, if an element is not iterable, or\ndoes not consist of exactly two elements.</p>\n<p><a id=\"ERR_INVALID_URL\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_INVALID_TUPLE"
            },
            {
              "textRaw": "ERR_INVALID_URL",
              "name": "err_invalid_url",
              "desc": "<p>Used when an invalid URL is passed to the <a href=\"url.html#url_the_whatwg_url_api\">WHATWG</a>\n<a href=\"url.html#url_constructor_new_url_input_base\"><code>URL</code> constructor</a> to be parsed. The thrown error object\ntypically has an additional property <code>&#39;input&#39;</code> that contains the URL that failed\nto parse.</p>\n<p><a id=\"ERR_INVALID_URL_SCHEME\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_INVALID_URL"
            },
            {
              "textRaw": "ERR_INVALID_URL_SCHEME",
              "name": "err_invalid_url_scheme",
              "desc": "<p>Used generically to signify an attempt to use a URL of an incompatible scheme\n(aka protocol) for a specific purpose. It is currently only used in the\n<a href=\"url.html#url_the_whatwg_url_api\">WHATWG URL API</a> support in the <a href=\"fs.html\"><code>fs</code></a> module (which only accepts URLs with\n<code>&#39;file&#39;</code> scheme), but may be used in other Node.js APIs as well in the future.</p>\n<p><a id=\"ERR_IPC_CHANNEL_CLOSED\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_INVALID_URL_SCHEME"
            },
            {
              "textRaw": "ERR_IPC_CHANNEL_CLOSED",
              "name": "err_ipc_channel_closed",
              "desc": "<p>Used when an attempt is made to use an IPC communication channel that has\nalready been closed.</p>\n<p><a id=\"ERR_IPC_DISCONNECTED\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_IPC_CHANNEL_CLOSED"
            },
            {
              "textRaw": "ERR_IPC_DISCONNECTED",
              "name": "err_ipc_disconnected",
              "desc": "<p>Used when an attempt is made to disconnect an already disconnected IPC\ncommunication channel between two Node.js processes. See the documentation for\nthe <a href=\"child_process.html\"><code>child_process</code></a> module for more information.</p>\n<p><a id=\"ERR_IPC_ONE_PIPE\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_IPC_DISCONNECTED"
            },
            {
              "textRaw": "ERR_IPC_ONE_PIPE",
              "name": "err_ipc_one_pipe",
              "desc": "<p>Used when an attempt is made to create a child Node.js process using more than\none IPC communication channel. See the documentation for the\n<a href=\"child_process.html\"><code>child_process</code></a> module for more information.</p>\n<p><a id=\"ERR_IPC_SYNC_FORK\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_IPC_ONE_PIPE"
            },
            {
              "textRaw": "ERR_IPC_SYNC_FORK",
              "name": "err_ipc_sync_fork",
              "desc": "<p>Used when an attempt is made to open an IPC communication channel with a\nsynchronous forked Node.js process. See the documentation for the\n<a href=\"child_process.html\"><code>child_process</code></a> module for more information.</p>\n<p><a id=\"ERR_MISSING_ARGS\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_IPC_SYNC_FORK"
            },
            {
              "textRaw": "ERR_MISSING_ARGS",
              "name": "err_missing_args",
              "desc": "<p>Used when a required argument of a Node.js API is not passed. This is currently\nonly used in the <a href=\"url.html#url_the_whatwg_url_api\">WHATWG URL API</a> for strict compliance with the specification\n(which in some cases may accept <code>func(undefined)</code> but not <code>func()</code>). In most\nnative Node.js APIs, <code>func(undefined)</code> and <code>func()</code> are treated identically, and\nthe <a href=\"#ERR_INVALID_ARG_TYPE\"><code>ERR_INVALID_ARG_TYPE</code></a> error code may be used instead.</p>\n<p><a id=\"ERR_NO_ICU\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_MISSING_ARGS"
            },
            {
              "textRaw": "ERR_NO_ICU",
              "name": "err_no_icu",
              "desc": "<p>Used when an attempt is made to use features that require <a href=\"intl.html#intl_internationalization_support\">ICU</a>, while\nNode.js is not compiled with ICU support.</p>\n<p><a id=\"ERR_SOCKET_ALREADY_BOUND\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_NO_ICU"
            },
            {
              "textRaw": "ERR_SOCKET_ALREADY_BOUND",
              "name": "err_socket_already_bound",
              "desc": "<p>Used when an attempt is made to bind a socket that has already been bound.</p>\n<p><a id=\"ERR_SOCKET_BAD_PORT\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_SOCKET_ALREADY_BOUND"
            },
            {
              "textRaw": "ERR_SOCKET_BAD_PORT",
              "name": "err_socket_bad_port",
              "desc": "<p>Used when an API function expecting a port &gt; 0 and &lt; 65536 receives an invalid\nvalue.</p>\n<p><a id=\"ERR_SOCKET_BAD_TYPE\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_SOCKET_BAD_PORT"
            },
            {
              "textRaw": "ERR_SOCKET_BAD_TYPE",
              "name": "err_socket_bad_type",
              "desc": "<p>Used when an API function expecting a socket type (<code>udp4</code> or <code>udp6</code>) receives an\ninvalid value.</p>\n<p><a id=\"ERR_SOCKET_CANNOT_SEND\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_SOCKET_BAD_TYPE"
            },
            {
              "textRaw": "ERR_SOCKET_CANNOT_SEND",
              "name": "err_socket_cannot_send",
              "desc": "<p>Used when data cannot be sent on a socket.</p>\n<p><a id=\"ERR_SOCKET_DGRAM_NOT_RUNNING\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_SOCKET_CANNOT_SEND"
            },
            {
              "textRaw": "ERR_SOCKET_DGRAM_NOT_RUNNING",
              "name": "err_socket_dgram_not_running",
              "desc": "<p>Used when a call is made and the UDP subsystem is not running.</p>\n<p><a id=\"ERR_STDERR_CLOSE\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_SOCKET_DGRAM_NOT_RUNNING"
            },
            {
              "textRaw": "ERR_STDERR_CLOSE",
              "name": "err_stderr_close",
              "desc": "<p>Used when an attempt is made to close the <code>process.stderr</code> stream. By design,\nNode.js does not allow <code>stdout</code> or <code>stderr</code> Streams to be closed by user code.</p>\n<p><a id=\"ERR_STDOUT_CLOSE\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_STDERR_CLOSE"
            },
            {
              "textRaw": "ERR_STDOUT_CLOSE",
              "name": "err_stdout_close",
              "desc": "<p>Used when an attempt is made to close the <code>process.stdout</code> stream. By design,\nNode.js does not allow <code>stdout</code> or <code>stderr</code> Streams to be closed by user code.</p>\n<p><a id=\"ERR_UNKNOWN_BUILTIN_MODULE\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_STDOUT_CLOSE"
            },
            {
              "textRaw": "ERR_UNKNOWN_BUILTIN_MODULE",
              "name": "err_unknown_builtin_module",
              "desc": "<p>Used to identify a specific kind of internal Node.js error that should not\ntypically be triggered by user code. Instances of this error point to an\ninternal bug within the Node.js binary itself.</p>\n<p><a id=\"ERR_UNKNOWN_SIGNAL\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_UNKNOWN_BUILTIN_MODULE"
            },
            {
              "textRaw": "ERR_UNKNOWN_SIGNAL",
              "name": "err_unknown_signal",
              "desc": "<p>Used when an invalid or unknown process signal is passed to an API expecting a\nvalid signal (such as <a href=\"child_process.html#child_process_subprocess_kill_signal\"><code>subprocess.kill()</code></a>).</p>\n<p><a id=\"ERR_UNKNOWN_STDIN_TYPE\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_UNKNOWN_SIGNAL"
            },
            {
              "textRaw": "ERR_UNKNOWN_STDIN_TYPE",
              "name": "err_unknown_stdin_type",
              "desc": "<p>Used when an attempt is made to launch a Node.js process with an unknown <code>stdin</code>\nfile type. Errors of this kind cannot <em>typically</em> be caused by errors in user\ncode, although it is not impossible. Occurrences of this error are most likely\nan indication of a bug within Node.js itself.</p>\n<p><a id=\"ERR_UNKNOWN_STREAM_TYPE\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_UNKNOWN_STDIN_TYPE"
            },
            {
              "textRaw": "ERR_UNKNOWN_STREAM_TYPE",
              "name": "err_unknown_stream_type",
              "desc": "<p>Used when an attempt is made to launch a Node.js process with an unknown\n<code>stdout</code> or <code>stderr</code> file type. Errors of this kind cannot <em>typically</em> be caused\nby errors in user code, although it is not impossible. Occurrences of this error\nare most likely an indication of a bug within Node.js itself.</p>\n<p><a id=\"ERR_V8BREAKITERATOR\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_UNKNOWN_STREAM_TYPE"
            },
            {
              "textRaw": "ERR_V8BREAKITERATOR",
              "name": "err_v8breakiterator",
              "desc": "<p>Used when the V8 BreakIterator API is used but the full ICU data set is not\ninstalled.</p>\n<p><a id=\"ERR_VALID_PERFORMANCE_ENTRY_TYPE\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_V8BREAKITERATOR"
            },
            {
              "textRaw": "ERR_VALID_PERFORMANCE_ENTRY_TYPE",
              "name": "err_valid_performance_entry_type",
              "desc": "<p>Used by the Performance Timing API (<code>perf_hooks</code>) when no valid performance\nentry types were found.</p>\n<p><a id=\"ERR_VALUE_OUT_OF_RANGE\"></a></p>\n",
              "type": "module",
              "displayName": "ERR_VALID_PERFORMANCE_ENTRY_TYPE"
            },
            {
              "textRaw": "ERR_VALUE_OUT_OF_RANGE",
              "name": "err_value_out_of_range",
              "desc": "<p>Used when a given value is out of the accepted range.</p>\n",
              "type": "module",
              "displayName": "ERR_VALUE_OUT_OF_RANGE"
            }
          ],
          "type": "misc",
          "displayName": "Node.js Error Codes"
        }
      ],
      "classes": [
        {
          "textRaw": "Class: Error",
          "type": "class",
          "name": "Error",
          "desc": "<p>A generic JavaScript <code>Error</code> object that does not denote any specific\ncircumstance of why the error occurred. <code>Error</code> objects capture a &quot;stack trace&quot;\ndetailing the point in the code at which the <code>Error</code> was instantiated, and may\nprovide a text description of the error.</p>\n<p>All errors generated by Node.js, including all System and JavaScript errors,\nwill either be instances of, or inherit from, the <code>Error</code> class.</p>\n",
          "methods": [
            {
              "textRaw": "Error.captureStackTrace(targetObject[, constructorOpt])",
              "type": "method",
              "name": "captureStackTrace",
              "signatures": [
                {
                  "params": [
                    {
                      "textRaw": "`targetObject` {Object} ",
                      "name": "targetObject",
                      "type": "Object"
                    },
                    {
                      "textRaw": "`constructorOpt` {Function} ",
                      "name": "constructorOpt",
                      "type": "Function",
                      "optional": true
                    }
                  ]
                },
                {
                  "params": [
                    {
                      "name": "targetObject"
                    },
                    {
                      "name": "constructorOpt",
                      "optional": true
                    }
                  ]
                }
              ],
              "desc": "<p>Creates a <code>.stack</code> property on <code>targetObject</code>, which when accessed returns\na string representing the location in the code at which\n<code>Error.captureStackTrace()</code> was called.</p>\n<pre><code class=\"lang-js\">const myObject = {};\nError.captureStackTrace(myObject);\nmyObject.stack;  // similar to `new Error().stack`\n</code></pre>\n<p>The first line of the trace will be prefixed with <code>${myObject.name}: ${myObject.message}</code>.</p>\n<p>The optional <code>constructorOpt</code> argument accepts a function. If given, all frames\nabove <code>constructorOpt</code>, including <code>constructorOpt</code>, will be omitted from the\ngenerated stack trace.</p>\n<p>The <code>constructorOpt</code> argument is useful for hiding implementation\ndetails of error generation from an end user. For instance:</p>\n<pre><code class=\"lang-js\">function MyError() {\n  Error.captureStackTrace(this, MyError);\n}\n\n// Without passing MyError to captureStackTrace, the MyError\n// frame would show up in the .stack property. By passing\n// the constructor, we omit that frame, and retain all frames below it.\nnew MyError().stack;\n</code></pre>\n"
            }
          ],
          "properties": [
            {
              "textRaw": "`stackTraceLimit` {number} ",
              "type": "number",
              "name": "stackTraceLimit",
              "desc": "<p>The <code>Error.stackTraceLimit</code> property specifies the number of stack frames\ncollected by a stack trace (whether generated by <code>new Error().stack</code> or\n<code>Error.captureStackTrace(obj)</code>).</p>\n<p>The default value is <code>10</code> but may be set to any valid JavaScript number. Changes\nwill affect any stack trace captured <em>after</em> the value has been changed.</p>\n<p>If set to a non-number value, or set to a negative number, stack traces will\nnot capture any frames.</p>\n"
            },
            {
              "textRaw": "`code` {string} ",
              "type": "string",
              "name": "code",
              "desc": "<p>The <code>error.code</code> property is a string label that identifies the kind of error.\nSee <a href=\"#nodejs-error-codes\">Node.js Error Codes</a> for details about specific codes.</p>\n"
            },
            {
              "textRaw": "`message` {string} ",
              "type": "string",
              "name": "message",
              "desc": "<p>The <code>error.message</code> property is the string description of the error as set by\ncalling <code>new Error(message)</code>. The <code>message</code> passed to the constructor will also\nappear in the first line of the stack trace of the <code>Error</code>, however changing\nthis property after the <code>Error</code> object is created <em>may not</em> change the first\nline of the stack trace (for example, when <code>error.stack</code> is read before this\nproperty is changed).</p>\n<pre><code class=\"lang-js\">const err = new Error(&#39;The message&#39;);\nconsole.error(err.message);\n// Prints: The message\n</code></pre>\n"
            },
            {
              "textRaw": "`stack` {string} ",
              "type": "string",
              "name": "stack",
              "desc": "<p>The <code>error.stack</code> property is a string describing the point in the code at which\nthe <code>Error</code> was instantiated.</p>\n<p>For example:</p>\n<pre><code class=\"lang-txt\">Error: Things keep happening!\n   at /home/gbusey/file.js:525:2\n   at Frobnicator.refrobulate (/home/gbusey/business-logic.js:424:21)\n   at Actor.&lt;anonymous&gt; (/home/gbusey/actors.js:400:8)\n   at increaseSynergy (/home/gbusey/actors.js:701:6)\n</code></pre>\n<p>The first line is formatted as <code>&lt;error class name&gt;: &lt;error message&gt;</code>, and\nis followed by a series of stack frames (each line beginning with &quot;at &quot;).\nEach frame describes a call site within the code that lead to the error being\ngenerated. V8 attempts to display a name for each function (by variable name,\nfunction name, or object method name), but occasionally it will not be able to\nfind a suitable name. If V8 cannot determine a name for the function, only\nlocation information will be displayed for that frame. Otherwise, the\ndetermined function name will be displayed with location information appended\nin parentheses.</p>\n<p>It is important to note that frames are <strong>only</strong> generated for JavaScript\nfunctions. If, for example, execution synchronously passes through a C++ addon\nfunction called <code>cheetahify</code>, which itself calls a JavaScript function, the\nframe representing the <code>cheetahify</code> call will <strong>not</strong> be present in the stack\ntraces:</p>\n<pre><code class=\"lang-js\">const cheetahify = require(&#39;./native-binding.node&#39;);\n\nfunction makeFaster() {\n  // cheetahify *synchronously* calls speedy.\n  cheetahify(function speedy() {\n    throw new Error(&#39;oh no!&#39;);\n  });\n}\n\nmakeFaster();\n// will throw:\n//   /home/gbusey/file.js:6\n//       throw new Error(&#39;oh no!&#39;);\n//           ^\n//   Error: oh no!\n//       at speedy (/home/gbusey/file.js:6:11)\n//       at makeFaster (/home/gbusey/file.js:5:3)\n//       at Object.&lt;anonymous&gt; (/home/gbusey/file.js:10:1)\n//       at Module._compile (module.js:456:26)\n//       at Object.Module._extensions..js (module.js:474:10)\n//       at Module.load (module.js:356:32)\n//       at Function.Module._load (module.js:312:12)\n//       at Function.Module.runMain (module.js:497:10)\n//       at startup (node.js:119:16)\n//       at node.js:906:3\n</code></pre>\n<p>The location information will be one of:</p>\n<ul>\n<li><code>native</code>, if the frame represents a call internal to V8 (as in <code>[].forEach</code>).</li>\n<li><code>plain-filename.js:line:column</code>, if the frame represents a call internal\n to Node.js.</li>\n<li><code>/absolute/path/to/file.js:line:column</code>, if the frame represents a call in\na user program, or its dependencies.</li>\n</ul>\n<p>The string representing the stack trace is lazily generated when the\n<code>error.stack</code> property is <strong>accessed</strong>.</p>\n<p>The number of frames captured by the stack trace is bounded by the smaller of\n<code>Error.stackTraceLimit</code> or the number of available frames on the current event\nloop tick.</p>\n<p>System-level errors are generated as augmented <code>Error</code> instances, which are\ndetailed <a href=\"#errors_system_errors\">here</a>.</p>\n"
            }
          ],
          "signatures": [
            {
              "params": [
                {
                  "textRaw": "`message` {string} ",
                  "name": "message",
                  "type": "string"
                }
              ],
              "desc": "<p>Creates a new <code>Error</code> object and sets the <code>error.message</code> property to the\nprovided text message. If an object is passed as <code>message</code>, the text message\nis generated by calling <code>message.toString()</code>. The <code>error.stack</code> property will\nrepresent the point in the code at which <code>new Error()</code> was called. Stack traces\nare dependent on <a href=\"https://github.com/v8/v8/wiki/Stack-Trace-API\">V8&#39;s stack trace API</a>. Stack traces extend only to either\n(a) the beginning of  <em>synchronous code execution</em>, or (b) the number of frames\ngiven by the property <code>Error.stackTraceLimit</code>, whichever is smaller.</p>\n"
            },
            {
              "params": [
                {
                  "name": "message"
                }
              ],
              "desc": "<p>Creates a new <code>Error</code> object and sets the <code>error.message</code> property to the\nprovided text message. If an object is passed as <code>message</code>, the text message\nis generated by calling <code>message.toString()</code>. The <code>error.stack</code> property will\nrepresent the point in the code at which <code>new Error()</code> was called. Stack traces\nare dependent on <a href=\"https://github.com/v8/v8/wiki/Stack-Trace-API\">V8&#39;s stack trace API</a>. Stack traces extend only to either\n(a) the beginning of  <em>synchronous code execution</em>, or (b) the number of frames\ngiven by the property <code>Error.stackTraceLimit</code>, whichever is smaller.</p>\n"
            }
          ]
        },
        {
          "textRaw": "Class: AssertionError",
          "type": "class",
          "name": "AssertionError",
          "desc": "<p>A subclass of <code>Error</code> that indicates the failure of an assertion. Such errors\ncommonly indicate inequality of actual and expected value.</p>\n<p>For example:</p>\n<pre><code class=\"lang-js\">assert.strictEqual(1, 2);\n// AssertionError [ERR_ASSERTION]: 1 === 2\n</code></pre>\n"
        },
        {
          "textRaw": "Class: RangeError",
          "type": "class",
          "name": "RangeError",
          "desc": "<p>A subclass of <code>Error</code> that indicates that a provided argument was not within the\nset or range of acceptable values for a function; whether that is a numeric\nrange, or outside the set of options for a given function parameter.</p>\n<p>For example:</p>\n<pre><code class=\"lang-js\">require(&#39;net&#39;).connect(-1);\n// throws &quot;RangeError: &quot;port&quot; option should be &gt;= 0 and &lt; 65536: -1&quot;\n</code></pre>\n<p>Node.js will generate and throw <code>RangeError</code> instances <em>immediately</em> as a form\nof argument validation.</p>\n"
        },
        {
          "textRaw": "Class: ReferenceError",
          "type": "class",
          "name": "ReferenceError",
          "desc": "<p>A subclass of <code>Error</code> that indicates that an attempt is being made to access a\nvariable that is not defined. Such errors commonly indicate typos in code, or\nan otherwise broken program.</p>\n<p>While client code may generate and propagate these errors, in practice, only V8\nwill do so.</p>\n<pre><code class=\"lang-js\">doesNotExist;\n// throws ReferenceError, doesNotExist is not a variable in this program.\n</code></pre>\n<p>Unless an application is dynamically generating and running code,\n<code>ReferenceError</code> instances should always be considered a bug in the code\nor its dependencies.</p>\n"
        },
        {
          "textRaw": "Class: SyntaxError",
          "type": "class",
          "name": "SyntaxError",
          "desc": "<p>A subclass of <code>Error</code> that indicates that a program is not valid JavaScript.\nThese errors may only be generated and propagated as a result of code\nevaluation. Code evaluation may happen as a result of <code>eval</code>, <code>Function</code>,\n<code>require</code>, or <a href=\"vm.html\">vm</a>. These errors are almost always indicative of a broken\nprogram.</p>\n<pre><code class=\"lang-js\">try {\n  require(&#39;vm&#39;).runInThisContext(&#39;binary ! isNotOk&#39;);\n} catch (err) {\n  // err will be a SyntaxError\n}\n</code></pre>\n<p><code>SyntaxError</code> instances are unrecoverable in the context that created them –\nthey may only be caught by other contexts.</p>\n"
        },
        {
          "textRaw": "Class: TypeError",
          "type": "class",
          "name": "TypeError",
          "desc": "<p>A subclass of <code>Error</code> that indicates that a provided argument is not an\nallowable type. For example, passing a function to a parameter which expects a\nstring would be considered a TypeError.</p>\n<pre><code class=\"lang-js\">require(&#39;url&#39;).parse(() =&gt; { });\n// throws TypeError, since it expected a string\n</code></pre>\n<p>Node.js will generate and throw <code>TypeError</code> instances <em>immediately</em> as a form\nof argument validation.</p>\n"
        }
      ]
    }
  ]
}
