{"record":{"id":"2923463d0c0c643c","repo":"twbs/bootstrap","slug":"no-method-named-config-292346","errorCode":null,"errorMessage":"No method named \"${config}\"","messagePattern":"No method named \"(.+?)\"","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"js/src/scrollspy.js","lineNumber":272,"sourceCode":"    parent.classList.remove(CLASS_NAME_ACTIVE)\n\n    const activeNodes = SelectorEngine.find(`${SELECTOR_TARGET_LINKS}.${CLASS_NAME_ACTIVE}`, parent)\n    for (const node of activeNodes) {\n      node.classList.remove(CLASS_NAME_ACTIVE)\n    }\n  }\n\n  // Static\n  static jQueryInterface(config) {\n    return this.each(function () {\n      const data = ScrollSpy.getOrCreateInstance(this, config)\n\n      if (typeof config !== 'string') {\n        return\n      }\n\n      if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {\n        throw new TypeError(`No method named \"${config}\"`)\n      }\n\n      data[config]()\n    })\n  }\n}\n\n/**\n * Data API implementation\n */\n\nEventHandler.on(window, EVENT_LOAD_DATA_API, () => {\n  for (const spy of SelectorEngine.find(SELECTOR_DATA_SPY)) {\n    ScrollSpy.getOrCreateInstance(spy)\n  }\n})\n\n/**","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/twbs/bootstrap/blob/6177d5f8497f2c08f9874f5221fd17ce5acd2ad7/js/src/scrollspy.js#L254-L290","documentation":"ScrollSpy's jQueryInterface applies the strict guard (method exists, no leading '_', not 'constructor'), and the component has exactly two public methods: refresh and dispose. refresh is the documented call after the monitored DOM changes (added/removed anchors); anything else — including update, which exists on Dropdown but not ScrollSpy — throws.","triggerScenarios":"$('#spy').scrollspy('update') — Dropdown has update, ScrollSpy does not; $('#spy').scrollspy('refreshList'); $('#spy').scrollspy('_offsets') (private, rejected); $('#spy').scrollspy('constructor').","commonSituations":"SPAs re-rendering nav content and guessing the method name; reusing code written for Dropdown; forgetting that after AJAX content changes refresh() is the required call.","solutions":["After DOM changes, call scrollspy('refresh') — the only operational method besides dispose.","Do not transfer 'update' from Dropdown to ScrollSpy.","Use the vanilla API: bootstrap.ScrollSpy.getInstance(spyEl)?.refresh().","Whitelist dynamic names to ['refresh', 'dispose']."],"exampleFix":"// before\n$('#spy').scrollspy('refreshList') // TypeError: No method named \"refreshList\"\n\n// after\n$('#spy').scrollspy('refresh') // refresh | dispose — call after adding/removing monitored elements","handlingStrategy":"validation","validationCode":"function callScrollSpyMethod(element, method) {\n  const instance = bootstrap.ScrollSpy.getOrCreateInstance(element)\n  const callable = typeof instance[method] === 'function' &&\n    !method.startsWith('_') && method !== 'constructor'\n  if (!callable) {\n    console.warn(`ScrollSpy: ignoring unknown method \"${method}\"`)\n    return\n  }\n  instance[method]()\n}","typeGuard":"const SCROLLSPY_METHODS = ['refresh', 'dispose'] as const\ntype ScrollSpyMethod = (typeof SCROLLSPY_METHODS)[number]\nconst isScrollSpyMethod = (m: string): m is ScrollSpyMethod =>\n  (SCROLLSPY_METHODS as readonly string[]).includes(m)","tryCatchPattern":"try {\n  $('#spy').scrollspy(method)\n} catch (err) {\n  if (err instanceof TypeError && err.message.startsWith('No method named')) {\n    console.warn(`ScrollSpy: unknown method \"${method}\"`)\n  } else {\n    throw err\n  }\n}","preventionTips":["After SPA/AJAX content changes, call scrollspy('refresh') — that is the only operational method.","Do not transfer Dropdown's 'update' to ScrollSpy.","Whitelist dynamic names to ['refresh', 'dispose'].","Prefer bootstrap.ScrollSpy.getInstance(spyEl)?.refresh()."],"tags":["bootstrap","scrollspy","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"}