Failed to execute on 'Node' Browser Origin: On your device Last updated 15 Oct 2026

Console: Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'

A DOM method received something that is not a DOM node — null, undefined, a string, or a jQuery/React object instead of an element.

Exact message you may see Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'Failed to execute 'insertBefore' on 'Node'Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this nodeparameter 1 is not of type 'Element'Failed to execute 'replaceChild' on 'Node'
Seen on: Chrome Firefox Safari JavaScript

Meaning

appendChild, insertBefore, replaceChild and similar need real Node objects. The usual cause is a failed lookup (getElementById returned null because the element did not exist yet) or passing a string where an element is needed (use append() or insertAdjacentHTML).

Common causes

  • document.getElementById / querySelector returned null (wrong id, script runs before the DOM is ready)
  • Passing a string, number or array instead of an element
  • Passing a jQuery object ($('#x')) instead of the DOM element ($('#x')[0])
  • Element created in another document/iframe
  • Typo in a variable name

⚡ Quick fix

  1. Check that the element exists before using it (if (el) …)
  2. Run code after DOMContentLoaded or put the script at the end of <body>
  3. Use el.append('text') for strings

Detailed fix by platform

JavaScript

  1. const el = document.getElementById('list'); if (!el) throw new Error('#list not found'); el.appendChild(li);
  2. For text: el.append('Hello')

Code examples

Run after the DOM exists

javascript
document.addEventListener('DOMContentLoaded', () => {
  const list = document.querySelector('#list');
  if (!list) return;                           // avoid the TypeError
  const li = document.createElement('li');
  li.textContent = 'New item';
  list.appendChild(li);                        // both arguments are real Nodes
});

How to diagnose

  1. Value — Is the argument null or the wrong type?
  2. Timing — Is the DOM ready?
  3. Selector — Does the id/class exist?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

addEventListener on null — TypeError: Cannot read properties of null (reading 'addEventListener') (JavaScript)addEventListener on n…Aw, Snap! — Chrome: Aw, Snap! Something went wrong while displaying this webpage. Error code: STATUS_ACCESS_VIOLATION / SIGILL / Out of Memory (Browser)Aw, Snap!captive portal — Browser: This network requires you to sign in — captive portal (hotel, airport, café Wi-Fi) blocking HTTPS sites (Browser)captive portalinvalid selector — DOMException: Failed to execute 'querySelector' on 'Document': 'x' is not a valid selector (JavaScript)invalid selectorreading length — TypeError: Cannot read properties of undefined (reading 'length') (JavaScript)reading lengthResizeObserver loop — ResizeObserver loop completed with undelivered notifications. (JavaScript)ResizeObserver loopThe canvas has been tainted by cross-origin data — Console: SecurityError: Failed to execute 'toDataURL' / 'getImageData' on 'HTMLCanvasElement': Tainted canvases may not be exported (Browser)The canvas has been t…Failed to…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.