vuetifyjs/vuetify · error · Error

Missing selection!

Error message

Missing selection!

What it means

Thrown by useSelection() when inject(VDataTableSelectionSymbol) is undefined. Selection state is created by createSelection() and provided by the data-table root; row/cell components consume it.

Source

Thrown at packages/vuetify/src/components/VDataTable/composables/select.ts:211

    selectAll,
    isSelected,
    isSomeSelected,
    someSelected,
    allSelected,
    showSelectAll,
    lastSelectedIndex,
    selectStrategy,
  }

  provide(VDataTableSelectionSymbol, data)

  return data
}

export function useSelection () {
  const data = inject(VDataTableSelectionSymbol)

  if (!data) throw new Error('Missing selection!')

  return data
}

View on GitHub (pinned to 8d153908df)

Solutions

  1. Call useSelection() only inside descendants of a VDataTable-family component.
  2. For a custom table, run createSelection(...) and provide(VDataTableSelectionSymbol, data).
  3. Confirm a single Vuetify install (Symbol.for keys must resolve identically).

Example fix

// before
const { toggleSelect } = useSelection()

// after
import { createSelection, VDataTableSelectionSymbol } from 'vuetify/components/VDataTable/composables/select'
const data = createSelection(/* props */, /* emit */)
provide(VDataTableSelectionSymbol, data)
Defensive patterns

Strategy: type-guard

Validate before calling

import { inject } from 'vue'
import { VDataTableSelectionSymbol } from 'vuetify/components/VDataTable/composables/select'
function hasSelectionProvider(): boolean {
  return inject(VDataTableSelectionSymbol, null) != null
}

Type guard

import { inject } from 'vue'
import { VDataTableSelectionSymbol } from 'vuetify/components/VDataTable/composables/select'
function insideSelectableTable(): boolean {
  return inject(VDataTableSelectionSymbol, null) != null
}

Try / catch

try {
  useSelection()
} catch (e) {
  if (e instanceof Error && /Missing selection/.test(e.message)) {
    // local selection fallback
  } else throw e
}

Prevention

When it happens

Trigger: Calling useSelection() in a component that is not a descendant of a VDataTable-family component that ran createSelection.

Common situations: Building a custom selectable row renderer outside the table, using the selection composable standalone, or duplicate Vuetify installs breaking symbol identity.

Related errors


AI-assisted analysis of vuetifyjs/vuetify@8d153908df (2026-08-12). Data as JSON: /api/errors/a4b9f4af18dbd474. Report an issue: GitHub.