Why do some visitors get ReferenceError: x is not defined?

The name in the message has no binding in that browser. If the Browser field shows one old browser, the page used a global that browser does not have. If every browser shows it, the script order or the bundle is wrong. Search also for Cannot access before initialization, because that ReferenceError does not contain the words is not defined.

Last updated 26 November 2026. By Paul Badarau.

Kenji, a fictional developer, ships a gallery. A few visitors report ReferenceError: DeskLight is not defined. DeskLight is a fictional global the page expects.

  1. The name in the message was used and has no binding. Open the event and read Browser. One old browser, with the rest of the traffic quiet, means that browser has no such global. ResizeObserver is not defined is that case. It is a different message from the loop notice the SDK drops by default, ResizeObserver loop completed with undelivered notifications.
  2. The same error on current browsers means the binding is missing from the page. An inline script placed above a file marked defer can run before that file creates the name. Two files can also split a name so the one that reads it never loaded the one that creates it. Create the name first, or ship it in the file that reads it.
  3. Safari words a missing binding as Can't find variable: DeskLight. A search for is not defined misses that wording. The same search misses Cannot access 'DeskLight' before initialization, which is a ReferenceError for a name that exists later in the same scope.

When the stack has in-app frames, grouping uses the exception type and those frames, not the missing name. A later missing name in the same function joins the issue and can change the title. Open the occurrence to see which name that visitor hit.

The product page for this is Monitoring.

Start your 14-day free trial