ERROR: /frontend_latest/chunk.543b2c7f6922940a8a31.js:3504:609517 TypeError: null is not an object (evaluating 'e.parentElement.replaceChild')

I get this error any time I load the HA GUI from ios (ios app + chrome + safari)

I also get the one below when I load it from Chrome on the laptop

Log Details (ERROR)
Fri Feb 07 2020 07:11:25 GMT-0600 (Central Standard Time)
:0:0 Script error.

Any ideas how to pinpoint/narrow down what is causing this other than just disabling pieces of lovelace?

That sounds like file corruption. I would make a backup, then either update or reinstall HA.

This error occurs when you read a property or call a method on a null object . That’s because the DOM API returns null for object references that are blank. An object is expected somewhere and wasn’t provided. So, you will get null is not an object error if the DOM elements have not been created before loading the script. In JavaScript , null is not an object; and won’t work. You must provide a proper object in the given situation.

We can resolve this type of issues by adding an event listener that will notify us when the page is ready. Once the addEventListener is fired, the init() method can make use of the DOM elements.

  document.addEventListener('readystatechange', function() {
    if (document.readyState === "complete") {
      init();
    }

since this is about the only direct thread on the exact issue I am experiencing, I’d like to add this happens on views with a conditional card (in a horizontal-stack), of which the condition isn’t evaluated to True.

Since that is rather a normal situation, it would be very nice this error wouldn’t flood the log. After some more investigation, I seems to be happening on the stack-in-card, and on the state-switch with a default: '' if the entity doesnt have a state listed in the possible states.

Ive solved that now with a conditional card:

type: conditional
conditions:
  - entity: sensor.count_alerts_notifying
    state_not: '0'
card:
  type: custom:state-switch
  #default: ''
  entity: sensor.count_alerts_notifying
  states:
    1:
      !include /config/lovelace/buttons/buttons_alerts_1.yaml
    2:
      !include /config/lovelace/buttons/buttons_alerts_2.yaml
    3:
      !include /config/lovelace/buttons/buttons_alerts_3.yaml
    4:
      !include /config/lovelace/buttons/buttons_alerts_4.yaml

this finally gets rid of the mentioned ‘null is not an object’ error…