vuetifyjs/vuetify · critical · Error

Could not find Vuetify theme injection

Error message

Could not find Vuetify theme injection

What it means

provideTheme() injects ThemeSymbol with a null default. ThemeSymbol is provided app-wide by createVuetify() (theme.install in framework.ts:84-90) and re-provided by provideTheme itself. It throws when no theme was ever injected, i.e. Vuetify is not installed on the app.

Source

Thrown at packages/vuetify/src/composables/theme.ts:650

    themes,
    current,
    computedThemes,
    prefix: parsedOptions.prefix,
    themeClasses,
    styles,
    global: {
      name: globalName,
      current,
    },
  }
}

export function provideTheme (props: { theme?: string }) {
  getCurrentInstance('provideTheme')

  const theme = inject(ThemeSymbol, null)

  if (!theme) throw new Error('Could not find Vuetify theme injection')

  const name = toRef(() => props.theme ?? theme.name.value)
  const current = toRef(() => theme.computedThemes.value[name.value])

  const themeClasses = toRef(() => theme.isDisabled ? undefined : `${theme.prefix}theme--${name.value}`)

  const newTheme: ThemeInstance = {
    ...theme,
    name,
    current,
    themeClasses,
  }

  provide(ThemeSymbol, newTheme)

  return newTheme
}

View on GitHub (pinned to 8d153908df)

Solutions

  1. Call app.use(createVuetify()) so the global theme is provided.
  2. Avoid disabling theme.install unless you provide ThemeSymbol yourself.
  3. Install Vuetify in every app and in the test harness.

Example fix

// before
const app = createApp(App)
app.mount('#app')

// after
const app = createApp(App)
app.use(createVuetify())
app.mount('#app')
Defensive patterns

Strategy: validation

Validate before calling

import { inject } from 'vue'
import { ThemeSymbol } from 'vuetify'
const theme = inject(ThemeSymbol, null)
if (!theme) {
  // Vuetify not installed: do not call provideTheme; report a config error.
}

Type guard

import { inject } from 'vue'
import { ThemeSymbol } from 'vuetify'
export function hasTheme (): boolean {
  return inject(ThemeSymbol, null) != null
}

Prevention

When it happens

Trigger: Calling provideTheme() (used by any component that scopes a theme, e.g. via a theme prop) on an app that never ran app.use(createVuetify()).

Common situations: Vuetify plugin not installed; theme.install disabled or skipped; second app instance without Vuetify; test without createVuetify().

Related errors


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