twbs/bootstrap · error · TypeError
No method named "${config}"
Error message
No method named "${config}" What it means
Popover reuses Tooltip's method surface through class inheritance, and its jQueryInterface throws when the string is not found on the instance (simple undefined check). Public methods are show, hide, toggle, enable, disable, toggleEnabled, update, setContent and dispose. The content API added in 5.2 is setContent — updateContent does not exist.
Source
Thrown at js/src/popover.js:83
[SELECTOR_CONTENT]: this._getContent()
}
}
_getContent() {
return this._resolvePossibleFunction(this._config.content)
}
// Static
static jQueryInterface(config) {
return this.each(function () {
const data = Popover.getOrCreateInstance(this, config)
if (typeof config !== 'string') {
return
}
if (typeof data[config] === 'undefined') {
throw new TypeError(`No method named "${config}"`)
}
data[config]()
})
}
}
/**
* jQuery
*/
defineJQueryPlugin(Popover)
export default Popover
View on GitHub (pinned to 6177d5f849)
Solutions
- Use the inherited Tooltip methods: show, hide, toggle, enable, disable, toggleEnabled, update, setContent, dispose.
- Replace 'destroy' with 'dispose' (v5 rename).
- Use setContent({ '.popover-body': '...' }) for dynamic content, not updateContent.
- Validate dynamic names against bootstrap.Popover.getInstance(el) before calling.
Example fix
// before
$('#pop').popover('updateContent', 'Hi') // TypeError: No method named "updateContent"
// after
$('#pop').popover('setContent', { '.popover-body': 'Hi' }) Defensive patterns
Strategy: validation
Validate before calling
function callPopoverMethod(element, method, ...args) {
const instance = bootstrap.Popover.getOrCreateInstance(element)
if (typeof instance[method] !== 'function') {
console.warn(`Popover: ignoring unknown method "${method}"`)
return
}
instance[method](...args)
} Type guard
const POPOVER_METHODS = ['show', 'hide', 'toggle', 'enable', 'disable', 'toggleEnabled', 'update', 'setContent', 'dispose'] as const type PopoverMethod = (typeof POPOVER_METHODS)[number] const isPopoverMethod = (m: string): m is PopoverMethod => (POPOVER_METHODS as readonly string[]).includes(m)
Try / catch
try {
$('#pop').popover(method)
} catch (err) {
if (err instanceof TypeError && err.message.startsWith('No method named')) {
console.warn(`Popover: unknown method "${method}"`)
} else {
throw err
}
} Prevention
- Apply the v4→v5 rename: destroy → dispose.
- Use setContent (5.2+) for dynamic content; updateContent does not exist.
- Whitelist dynamic names against the nine inherited methods.
- Prefer the vanilla API for dynamic dispatch.
When it happens
Trigger: $('#pop').popover('updateContent', {...}) — correct is setContent; $('#pop').popover('destroy') — v4 name, v5 is dispose; $('#pop').popover('open'); $('#pop').popover('setContentX').
Common situations: v4→v5 migrations ('destroy' → 'dispose'); developers guessing updateContent because setContent arrived mid-5.x; mixing Tooltip/Popover verbs with other UI libraries.
Related errors
- No method named "${config}"
- No method named "${config}"
- No method named "${config}"
- No method named "${config}"
- No method named "${config}"
AI-assisted analysis of twbs/bootstrap@6177d5f849 (2026-08-22).
Data as JSON: /api/errors/fbeacb93dbcabebc.
Report an issue: GitHub.