{"record":{"id":"787ef22246cac091","repo":"Semantic-Org/Semantic-UI","slug":"context-specified-does-not-exist","errorCode":null,"errorMessage":"Context specified does not exist","messagePattern":"Context specified does not exist","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/definitions/modules/sticky.js","lineNumber":963,"sourceCode":"  onScroll       : function(){},\n\n  // Called when element is stuck to viewport\n  onStick        : function(){},\n\n  // Called when element is unstuck from viewport\n  onUnstick      : function(){},\n\n  // Called when element reaches top of context\n  onTop          : function(){},\n\n  // Called when element reaches bottom of context\n  onBottom       : function(){},\n\n  error         : {\n    container      : 'Sticky element must be inside a relative container',\n    visible        : 'Element is hidden, you must call refresh after element becomes visible. Use silent setting to surpress this warning in production.',\n    method         : 'The method you called is not defined.',\n    invalidContext : 'Context specified does not exist',\n    elementSize    : 'Sticky element is larger than its container, cannot create sticky.'\n  },\n\n  className : {\n    bound     : 'bound',\n    fixed     : 'fixed',\n    supported : 'native',\n    top       : 'top',\n    bottom    : 'bottom'\n  }\n\n};\n\n})( jQuery, window, document );\n","sourceCodeStart":945,"sourceCodeEnd":978,"githubUrl":"https://github.com/Semantic-Org/Semantic-UI/blob/597843ab84d565cccfd8fd7719416350ae73e734/src/definitions/modules/sticky.js#L945-L978","documentation":"Emitted by Sticky's determineContext() (sticky.js:153-154) when settings.context is set but $(settings.context).length === 0 — the context selector matched no element. Sticky needs a positioned ancestor to compute stickiness, so without a valid context it cannot initialize and returns early. It is a console.error via module.error (sticky.js:776), not a thrown exception.","triggerScenarios":"$('.sticky').sticky({ context: '#missing' }) where '#missing' does not exist in the DOM at initialization time, or where the context is inside a scope jQuery cannot reach (e.g. closed shadow DOM).","commonSituations":"Context rendered later via AJAX/SPA navigation, wrong selector, context element removed before init, context selector scoped inside a container that hasn't mounted yet.","solutions":["Ensure the context element exists in the DOM before calling .sticky().","Initialize inside a callback/ready handler that runs after the context is mounted, or after your AJAX resolves.","Omit settings.context to let Sticky use $module.offsetParent() automatically (sticky.js:142, 151).","After the context appears, call $('.sticky').sticky('refresh') to re-resolve it."],"exampleFix":"// before\n$('.sticky').sticky({ context: '#sidebar' }); // #sidebar not yet in DOM\n// after\n$.get('/sidebar', function(html){\n  $('body').append(html);\n  $('.sticky').sticky({ context: '#sidebar' });\n});","handlingStrategy":"validation","validationCode":"// Resolve the context selector BEFORE initializing sticky.\nfunction initSticky($el, ctxSelector){\n  if (ctxSelector && $(ctxSelector).length === 0) {\n    throw new Error('Sticky context not found: ' + ctxSelector);\n  }\n  $el.sticky({ context: ctxSelector });\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Initialize sticky only after the context element is in the DOM (e.g. inside the AJAX callback or mount hook).","If the context may arrive late, omit settings.context to use the offsetParent automatically, then call refresh when it appears.","These are console.error logs (sticky.js:776), not exceptions — guard with explicit checks, not try/catch."],"tags":["sticky","context","dom","init-order"],"backgroundTag":null,"analyzedSha":"597843ab84d565cccfd8fd7719416350ae73e734","analyzedAt":"2026-08-13T01:44:23.827Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}