quasarframework/quasar · warning
Tried to remove listener but the callback specified is not a
Error message
Tried to remove listener but the callback specified is not a function.
What it means
BexBridge.off(event, callback) was called with a callback that is not a function (and not undefined, which means remove-all). The bridge warns and removes nothing, so the listener stays attached and keeps firing.
Source
Thrown at app-vite/exports/bex/private/bex-bridge.js:329
`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]
}
this.log(`Stopped listening for "${event}".`)
return
}
if (typeof callback !== 'function') {
this.warn(
'Tried to remove listener but the callback specified is not a function.'
)
return
}
const liveEvents = list.filter(entry => entry.callback !== callback)
if (liveEvents.length !== 0) {
this.listeners[event] = liveEvents
this.log(`Removed a listener for: "${event}".`)
} else {
delete this.listeners[event]
this.log(`Stopped listening for: "${event}".`)
}
}
/**
* @param {{ event: string, to: string, payload: any } | undefined} paramView on GitHub (pinned to 4841521b5f)
Solutions
- Pass the exact same function reference given to on()/once() as the second argument.
- If you intend to remove all listeners for the event, omit the callback argument instead.
- Store the handler reference (don't create a new arrow function) so it can be removed later.
Example fix
// before
bridge.on('tick', () => update())
bridge.off('tick', () => update()) // new reference, and removal path
// after
const onTick = () => update()
bridge.on('tick', onTick)
bridge.off('tick', onTick) Defensive patterns
Strategy: type-guard
Type guard
const canOff = (event, cb) => typeof event === 'string' && event.length > 0 && (cb === undefined || typeof cb === 'function')
Prevention
- Keep the original function reference used in on() for later removal.
- Omit the callback entirely to remove all listeners for an event.
- Check argument order: off(event, callback).
When it happens
Trigger: bridge.off('event', someNonFunction) — e.g. passing the handler's return value, an event object, or a bound-but-wrong argument order.
Common situations: Argument order confusion (off(callback, event)); passing a method reference that got wrapped/replaced; cleanup code receiving the wrong variable scope.
Related errors
- Tried add listener but no valid callback function specified.
- Error while triggering listener${plural} for event: "${messa
- Connection with "${port.name}" already exists. Disconnecting
- Tried add listener but no event specified.
- Tried to remove listeners but no event specified.
AI-assisted analysis of quasarframework/quasar@4841521b5f (2026-08-30).
Data as JSON: /api/errors/9755f58ab3a1c85f.
Report an issue: GitHub.