Semantic-Org/Semantic-UI · info

The method you called is not defined.

Error message

The method you called is not defined.

What it means

This string lives under $.fn.sticky.settings.error.method, intended for unknown method-name invocations. In this codebase version Sticky's invoke() dispatcher (sticky.js:831-883) never calls module.error(error.method): when a string query resolves to nothing, 'found' stays undefined and the call silently returns undefined. So the message is dead config — you will not actually see it logged by Sticky. Like every module, module.error is a bound console.error (sticky.js:776), not a thrown exception, so try/catch is irrelevant.

Source

Thrown at src/definitions/modules/sticky.js:962

  // Called on each scroll
  onScroll       : function(){},

  // Called when element is stuck to viewport
  onStick        : function(){},

  // Called when element is unstuck from viewport
  onUnstick      : function(){},

  // Called when element reaches top of context
  onTop          : function(){},

  // Called when element reaches bottom of context
  onBottom       : function(){},

  error         : {
    container      : 'Sticky element must be inside a relative container',
    visible        : 'Element is hidden, you must call refresh after element becomes visible. Use silent setting to surpress this warning in production.',
    method         : 'The method you called is not defined.',
    invalidContext : 'Context specified does not exist',
    elementSize    : 'Sticky element is larger than its container, cannot create sticky.'
  },

  className : {
    bound     : 'bound',
    fixed     : 'fixed',
    supported : 'native',
    top       : 'top',
    bottom    : 'bottom'
  }

};

})( jQuery, window, document );

View on GitHub (pinned to 597843ab84)

Solutions

  1. Spell the method name correctly and confirm it exists for Sticky in this version (e.g. 'refresh', 'scrollToTop').
  2. Check the exact Semantic UI version's docs — method sets differ across releases.
  3. Do not rely on try/catch to surface this; it is never thrown. If you need a hard failure, assert the return value is defined.

Example fix

// before
$('.sticky').sticky('refesh'); // typo -> silent no-op, returns undefined
// after
$('.sticky').sticky('refresh'); // valid method
Defensive patterns

Strategy: validation

Validate before calling

// Sticky's invoke() returns undefined for unknown methods (never throws).
// Validate against the known method list before calling.
var stickyMethods = ['refresh','observeChanges','set offset','set container','is sticky','bound','unbound','bind events','unbind events','scrollToTop','destroy'];
function callSticky($el, method, args){
  if (stickyMethods.indexOf(method) === -1 && typeof $el.sticky('module')[method] === 'undefined') {
    throw new Error('Unknown sticky method: ' + method);
  }
  return $el.sticky(method, args);
}

Prevention

When it happens

Trigger: $('.sticky').sticky('nonexistentMethod') — the dispatcher (sticky.js:843-865) walks camelCase/dotted segments against the module instance, finds no match, sets found=undefined, and returns undefined with no console output.

Common situations: Typo in a method name, using a method from a different Semantic UI version, copy-pasting an API call from another module (e.g. dropdown) into sticky.

Related errors


AI-assisted analysis of Semantic-Org/Semantic-UI@597843ab84 (2026-08-13). Data as JSON: /api/errors/d6c5aa5e6a7ee334. Report an issue: GitHub.