{"record":{"id":"9755f58ab3a1c85f","repo":"quasarframework/quasar","slug":"tried-to-remove-listener-but-the-callback-specifie","errorCode":null,"errorMessage":"Tried to remove listener but the callback specified is not a function.","messagePattern":"Tried to remove listener but the callback specified is not a function\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"app-vite/exports/bex/private/bex-bridge.js","lineNumber":329,"sourceCode":"        `Tried to remove listener for \"${event}\" event but there is no such listener attached.`\n      )\n      return\n    }\n\n    if (callback === void 0) {\n      if (event.startsWith('@quasar:')) {\n        // ensure we don't remove internal listeners\n        this.listeners[event] = [list[0]]\n      } else {\n        delete this.listeners[event]\n      }\n\n      this.log(`Stopped listening for \"${event}\".`)\n      return\n    }\n\n    if (typeof callback !== 'function') {\n      this.warn(\n        'Tried to remove listener but the callback specified is not a function.'\n      )\n      return\n    }\n\n    const liveEvents = list.filter(entry => entry.callback !== callback)\n\n    if (liveEvents.length !== 0) {\n      this.listeners[event] = liveEvents\n      this.log(`Removed a listener for: \"${event}\".`)\n    } else {\n      delete this.listeners[event]\n      this.log(`Stopped listening for: \"${event}\".`)\n    }\n  }\n\n  /**\n   * @param {{ event: string, to: string, payload: any } | undefined} param","sourceCodeStart":311,"sourceCodeEnd":347,"githubUrl":"https://github.com/quasarframework/quasar/blob/4841521b5f635a971eb9e2710e5542efd194691b/app-vite/exports/bex/private/bex-bridge.js#L311-L347","documentation":"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.","triggerScenarios":"bridge.off('event', someNonFunction) — e.g. passing the handler's return value, an event object, or a bound-but-wrong argument order.","commonSituations":"Argument order confusion (off(callback, event)); passing a method reference that got wrapped/replaced; cleanup code receiving the wrong variable scope.","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."],"exampleFix":"// before\nbridge.on('tick', () => update())\nbridge.off('tick', () => update()) // new reference, and removal path\n// after\nconst onTick = () => update()\nbridge.on('tick', onTick)\nbridge.off('tick', onTick)","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"const canOff = (event, cb) =>\n  typeof event === 'string' && event.length > 0 &&\n  (cb === undefined || typeof cb === 'function')","tryCatchPattern":null,"preventionTips":["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)."],"tags":["bex","extension","invalid-argument","callback"],"backgroundTag":"callback-not-a-function","analyzedSha":"4841521b5f635a971eb9e2710e5542efd194691b","analyzedAt":"2026-08-30T01:13:14.944Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}