Semantic-Org/Semantic-UI · error

History enabled, but no path was specified

Error message

History enabled, but no path was specified

What it means

Semantic UI Tab error logged at tab.js:195 when history is enabled with historyType 'state' but settings.path is falsy. The HTML5 history-state mode needs a base path to write into $.address.state(...); without one it cannot initialize state.

Source

Thrown at src/definitions/modules/tab.js:927

  apiSettings     : false,      // settings for api call
  evaluateScripts : 'once',     // whether inline scripts should be parsed (true/false/once). Once will not re-evaluate on cached content

  onFirstLoad : function(tabPath, parameterArray, historyEvent) {}, // called first time loaded
  onLoad      : function(tabPath, parameterArray, historyEvent) {}, // called on every load
  onVisible   : function(tabPath, parameterArray, historyEvent) {}, // called every time tab visible
  onRequest   : function(tabPath, parameterArray, historyEvent) {}, // called ever time a tab beings loading remote content

  templates : {
    determineTitle: function(tabArray) {} // returns page title for path
  },

  error: {
    api        : 'You attempted to load content without API module',
    method     : 'The method you called is not defined',
    missingTab : 'Activated tab cannot be found. Tabs are case-sensitive.',
    noContent  : 'The tab you specified is missing a content url.',
    path       : 'History enabled, but no path was specified',
    recursion  : 'Max recursive depth reached',
    legacyInit : 'onTabInit has been renamed to onFirstLoad in 2.0, please adjust your code.',
    legacyLoad : 'onTabLoad has been renamed to onLoad in 2.0. Please adjust your code',
    state      : 'History requires Asual\'s Address library <https://github.com/asual/jquery-address>'
  },

  metadata : {
    tab    : 'tab',
    loaded : 'loaded',
    promise: 'promise'
  },

  className   : {
    loading : 'loading',
    active  : 'active'
  },

  selector    : {

View on GitHub (pinned to 597843ab84)

Solutions

  1. Set an explicit path: { history: true, historyType: 'state', path: '/app' }.
  2. Disable history if state-based routing is not required: { history: false }.
  3. Use historyType 'hash' instead, which does not require a base path.

Example fix

// before
$('.menu .item').tab({ history: true, historyType: 'state' });
// after
$('.menu .item').tab({ history: true, historyType: 'state', path: '/dashboard' });
Defensive patterns

Strategy: validation

Validate before calling

function validateTabHistoryConfig(cfg) {
  if (cfg && cfg.history && cfg.historyType === 'state' && !cfg.path) {
    throw new Error('Tab historyType "state" requires a non-empty settings.path');
  }
}

Type guard

function isValidStateHistoryConfig(cfg) {
  return !cfg || !cfg.history || cfg.historyType !== 'state' || (typeof cfg.path === 'string' && cfg.path.length > 0);
}

Prevention

When it happens

Trigger: Initializing the tab module with { history: true, historyType: 'state' } but omitting or explicitly setting path:false.

Common situations: Copy-pasting a tab config that enabled history but stripping the path; SPA root where the base path is computed dynamically and resolves to undefined; enabling history accidentally via a shared settings object.

Related errors


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