quasarframework/quasar · warning

Tried to remove listeners but no event specified.

Error message

Tried to remove listeners but no event specified.

What it means

BexBridge.off(event, callback) was called with an empty/undefined/falsy event name. The bridge warns and removes nothing.

Source

Thrown at app-vite/exports/bex/private/bex-bridge.js:303

    }

    if (typeof callback !== 'function') {
      this.warn('Tried add listener but no valid callback function specified.')
      return
    }

    const target = (this.listeners[event] ||= [])
    target.push({ type: 'once', callback })
    this.log(`Added a one-time listener for event: "${event}".`)
  }

  /**
   * @param {string} event
   * @param {(message: Message) => void} callback
   */
  off(event, callback) {
    if (!event) {
      this.warn('Tried to remove listeners but no event specified.')
      return
    }

    const list = this.listeners[event]

    if (list === void 0) {
      this.warn(
        `Tried to remove listener for "${event}" event but there is no such listener attached.`
      )
      return
    }

    if (callback === void 0) {
      if (event.startsWith('@quasar:')) {
        // ensure we don't remove internal listeners
        this.listeners[event] = [list[0]]
      } else {
        delete this.listeners[event]

View on GitHub (pinned to 4841521b5f)

Solutions

  1. Pass the same non-empty string used at registration to off().
  2. Persist the event name (module constant) rather than transient state for cleanup.
  3. Skip the off() call when you know no listener was registered.

Example fix

// before
onUnmounted(() => bridge.off(eventName, handler)) // eventName lost
// after
const EVENT = 'my-event'
bridge.on(EVENT, handler)
onUnmounted(() => bridge.off(EVENT, handler))
Defensive patterns

Strategy: validation

Validate before calling

if (typeof event === 'string' && event.length > 0) {
  bridge.off(event, handler)
}

Type guard

const isValidEventName = (e) => typeof e === 'string' && e.trim().length > 0

Prevention

When it happens

Trigger: bridge.off(undefined, handler) or bridge.off('', handler), often when the event name comes from a variable that is empty at teardown time.

Common situations: Cleanup code in component unmount where the event-name constant failed to import; storing event names in state that got cleared before cleanup runs.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of quasarframework/quasar@4841521b5f (2026-08-30). Data as JSON: /api/errors/f76c8c94a67d7f05. Report an issue: GitHub.