{"record":{"id":"663c78e7c1444a5e","repo":"twbs/bootstrap","slug":"no-method-named-config-663c78","errorCode":null,"errorMessage":"No method named \"${config}\"","messagePattern":"No method named \"(.+?)\"","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"js/src/toast.js","lineNumber":203,"sourceCode":"    EventHandler.on(this._element, EVENT_MOUSEOVER, event => this._onInteraction(event, true))\n    EventHandler.on(this._element, EVENT_MOUSEOUT, event => this._onInteraction(event, false))\n    EventHandler.on(this._element, EVENT_FOCUSIN, event => this._onInteraction(event, true))\n    EventHandler.on(this._element, EVENT_FOCUSOUT, event => this._onInteraction(event, false))\n  }\n\n  _clearTimeout() {\n    clearTimeout(this._timeout)\n    this._timeout = null\n  }\n\n  // Static\n  static jQueryInterface(config) {\n    return this.each(function () {\n      const data = Toast.getOrCreateInstance(this, config)\n\n      if (typeof config === 'string') {\n        if (typeof data[config] === 'undefined') {\n          throw new TypeError(`No method named \"${config}\"`)\n        }\n\n        data[config](this)\n      }\n    })\n  }\n}\n\n/**\n * Data API implementation\n */\n\nenableDismissTrigger(Toast)\n\n/**\n * jQuery\n */\n","sourceCodeStart":185,"sourceCodeEnd":221,"githubUrl":"https://github.com/twbs/bootstrap/blob/6177d5f8497f2c08f9874f5221fd17ce5acd2ad7/js/src/toast.js#L185-L221","documentation":"Toast's jQueryInterface only acts on string arguments and uses the simple undefined guard, then calls data[config](this). Public methods are show, hide and dispose (isShown also exists on the instance). Non-string arguments such as numbers or objects do not throw here — they silently just create the instance.","triggerScenarios":"$('#toast').toast('display'); $('#toast').toast('remove'); $('#toast').toast('destroy') (v4 name → v5 dispose); $('#toast').toast('hideNow').","commonSituations":"Notification code written with remove/dismiss vocabulary; v4→v5 migrations ('destroy' → 'dispose'); toast managers forwarding arbitrary command strings.","solutions":["Use show, hide or dispose.","Replace 'destroy' with 'dispose' for v5.","For dynamic toast commands, whitelist the three names before dispatch.","Prefer the vanilla API: bootstrap.Toast.getOrCreateInstance(el).show()."],"exampleFix":"// before\n$('#toast').toast('display') // TypeError: No method named \"display\"\n\n// after\n$('#toast').toast('show') // show | hide | dispose","handlingStrategy":"validation","validationCode":"function callToastMethod(element, method) {\n  const instance = bootstrap.Toast.getOrCreateInstance(element)\n  if (typeof instance[method] !== 'function') {\n    console.warn(`Toast: ignoring unknown method \"${method}\"`)\n    return\n  }\n  instance[method](element)\n}","typeGuard":"const TOAST_METHODS = ['show', 'hide', 'dispose'] as const\ntype ToastMethod = (typeof TOAST_METHODS)[number]\nconst isToastMethod = (m: string): m is ToastMethod =>\n  (TOAST_METHODS as readonly string[]).includes(m)","tryCatchPattern":"try {\n  $('#toast').toast(method)\n} catch (err) {\n  if (err instanceof TypeError && err.message.startsWith('No method named')) {\n    console.warn(`Toast: unknown method \"${method}\"`)\n  } else {\n    throw err\n  }\n}","preventionTips":["Use show/hide/dispose; map notification verbs (display, remove, dismiss) to them.","Apply the v4→v5 rename: destroy → dispose.","Whitelist commands in toast managers before forwarding.","Prefer bootstrap.Toast.getOrCreateInstance(el).show()."],"tags":["bootstrap","toast","jquery","typeerror","method-dispatch"],"backgroundTag":"invalid-method-name","analyzedSha":"6177d5f8497f2c08f9874f5221fd17ce5acd2ad7","analyzedAt":"2026-08-22T03:20:03.375Z","schemaVersion":2},"datasetVersion":"2026-08-22T04:17:13.399Z"}