{"record":{"id":"c1f3a99d464e23b0","repo":"twbs/bootstrap","slug":"no-method-named-config-c1f3a9","errorCode":null,"errorMessage":"No method named \"${config}\"","messagePattern":"No method named \"(.+?)\"","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"js/src/modal.js","lineNumber":327,"sourceCode":"    }\n  }\n\n  _resetAdjustments() {\n    this._element.style.paddingLeft = ''\n    this._element.style.paddingRight = ''\n  }\n\n  // Static\n  static jQueryInterface(config, relatedTarget) {\n    return this.each(function () {\n      const data = Modal.getOrCreateInstance(this, config)\n\n      if (typeof config !== 'string') {\n        return\n      }\n\n      if (typeof data[config] === 'undefined') {\n        throw new TypeError(`No method named \"${config}\"`)\n      }\n\n      data[config](relatedTarget)\n    })\n  }\n}\n\n/**\n * Data API implementation\n */\n\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {\n  const target = SelectorEngine.getElementFromSelector(this)\n\n  if (['A', 'AREA'].includes(this.tagName)) {\n    event.preventDefault()\n  }\n","sourceCodeStart":309,"sourceCodeEnd":345,"githubUrl":"https://github.com/twbs/bootstrap/blob/6177d5f8497f2c08f9874f5221fd17ce5acd2ad7/js/src/modal.js#L309-L345","documentation":"Modal's jQueryInterface forwards a second argument to the method — data[config](relatedTarget), which only show and toggle actually accept — and throws when the method string is not an instance property. Public methods are toggle, show, hide, handleUpdate and dispose. The Bootstrap vocabulary is show/hide, not the open/close used by jQuery UI.","triggerScenarios":"$('#modal').modal('open') or modal('close') — jQuery UI vocabulary; $('#modal').modal('handleupdate') (case-sensitive handleUpdate); $('#modal').modal('toggleEnabled') (a Tooltip method, not Modal); $('#modal').modal('getInstance').","commonSituations":"Developers porting jQuery UI dialog code; copy-paste from older tutorials; mixing method vocabularies between Bootstrap components; passing static helper names through the bridge.","solutions":["Use show, hide, toggle, handleUpdate or dispose.","To forward a related target (V5.2.4+ show behavior), keep it as the second argument: $('#modal').modal('show', relatedTarget).","Fix jQuery UI habits: open → show, close → hide.","For dynamic dispatch, check the method exists on bootstrap.Modal.getInstance(el) first."],"exampleFix":"// before\n$('#modal').modal('open', evt.relatedTarget) // TypeError: No method named \"open\"\n\n// after\n$('#modal').modal('show', evt.relatedTarget) // toggle | show | hide | handleUpdate | dispose","handlingStrategy":"validation","validationCode":"function callModalMethod(element, method, relatedTarget) {\n  const instance = bootstrap.Modal.getOrCreateInstance(element)\n  if (typeof instance[method] !== 'function') {\n    console.warn(`Modal: ignoring unknown method \"${method}\"`)\n    return\n  }\n  instance[method](relatedTarget) // only show/toggle consume relatedTarget\n}","typeGuard":"const MODAL_METHODS = ['toggle', 'show', 'hide', 'handleUpdate', 'dispose'] as const\ntype ModalMethod = (typeof MODAL_METHODS)[number]\nconst isModalMethod = (m: string): m is ModalMethod =>\n  (MODAL_METHODS as readonly string[]).includes(m)","tryCatchPattern":"try {\n  $('#modal').modal(method, relatedTarget)\n} catch (err) {\n  if (err instanceof TypeError && err.message.startsWith('No method named')) {\n    console.warn(`Modal: unknown method \"${method}\"`)\n  } else {\n    throw err\n  }\n}","preventionTips":["Translate jQuery UI habits: open→show, close→hide.","Method names are case-sensitive — handleUpdate, not handleupdate.","Keep relatedTarget as the second jQuery-bridge argument only for show/toggle.","Whitelist dynamic names against the five public methods."],"tags":["bootstrap","modal","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"}