vuejs/core · error · Error
${key} compat has been disabled.
Error message
${key} compat has been disabled. What it means
Thrown by assertCompatEnabled in @vue/runtime-core's migration build when a Vue 2 feature (identified by a DeprecationTypes key) is used but compat is disabled for that feature or globally. assertCompatEnabled is reserved for features that are completely removed in the non-compat build — calling them without compat enabled is unrecoverable. compatConfig.ts:599 throws `${key} compat has been disabled.`
Source
Thrown at packages/runtime-core/src/compat/compatConfig.ts:599
: rawMode
if (mode === 2) {
return val !== false
} else {
return val === true || val === 'suppress-warning'
}
}
/**
* Use this for features that are completely removed in non-compat build.
*/
export function assertCompatEnabled(
key: DeprecationTypes,
instance: ComponentInternalInstance | null,
...args: any[]
): void {
if (!isCompatEnabled(key, instance)) {
throw new Error(`${key} compat has been disabled.`)
} else if (__DEV__) {
warnDeprecation(key, instance, ...args)
}
}
/**
* Use this for features where legacy usage is still possible, but will likely
* lead to runtime error if compat is disabled. (warn in all cases)
*/
export function softAssertCompatEnabled(
key: DeprecationTypes,
instance: ComponentInternalInstance | null,
...args: any[]
): boolean {
if (__DEV__) {
warnDeprecation(key, instance, ...args)
}
return isCompatEnabled(key, instance)View on GitHub (pinned to a2b40db9a8)
Solutions
- Re-enable the specific feature in configureCompat (set the DeprecationTypes key to true or 'suppress-warning') until you have removed its usages.
- Migrate the offending code to the Vue 3 equivalent for the named DeprecationTypes key (the key in the message tells you which feature).
- If using the migration build, ensure you are actually on `vue/compat` and MODE is 2, not 3.
- Search the codebase for the Vue 2 pattern indicated by the key and replace each call site.
Example fix
// before
import { configureCompat } from 'vue'
configureCompat({ MODE: 3, RENDER_FUNCTION: false })
// ... code still uses the removed render-function compat path
// after
configureCompat({ MODE: 2, RENDER_FUNCTION: true })
// or migrate the call site to the v3 API, then drop the flag Defensive patterns
Strategy: validation
Validate before calling
// Before using a removed Vue 2 feature, check compat is enabled.
import { isCompatEnabled } from 'vue/compat'
import { DeprecationTypes } from 'vue/compat'
function guardedFilterUsage(key = DeprecationTypes.FILTERS) {
if (!isCompatEnabled(key, null)) {
throw new Error(`${key} requires compat enabled; migrate to a method/computed.`)
}
// ... legacy filter usage
} Type guard
function compatFeatureEnabled(key: number, instance: any): boolean {
return isCompatEnabled(key, instance)
} Try / catch
try {
assertCompatEnabled(DeprecationTypes.FILTERS, instance)
// ... legacy code path
} catch (e) {
// migrate the call site, or re-enable the feature in configureCompat
throw e
} Prevention
- Migrate Vue 2 features (filters, $listeners, EventBus) before disabling their compat flags.
- In configureCompat, only set a feature to false once its last usage is removed.
- Search the codebase for the DeprecationTypes key in the message to find offending call sites.
When it happens
Trigger: Using the `vue/compat` (migration) build with compat MODE set to 3 (or a specific feature flag set to false) while still calling a fully-removed Vue 2 API such as the `filters` option, `$listeners`, the `destroy`/`destroyed` lifecycle hooks (in removed form), or event EventBus patterns guarded by assertCompatEnabled.
Common situations: Migrating from Vue 2 to 3 and disabling a deprecation feature flag (`configureCompat({ FEATURE_X: false })`) while code still uses that feature; running on the standard v3 build (no compat) against code expecting Vue 2 semantics; selectively turning off compat before removing the last usage.
Related errors
- [@vue/compiler-core] decodeEntities option is required in br
- [@vue/compiler-sfc] <script> and <script setup> must have th
- [@vue/compiler-sfc] SFC contains no <script> tags.
- [@vue/compiler-sfc] `modules` option is not supported in the
- [@vue/compiler-sfc] `modules` option can only be used with c
AI-assisted analysis of vuejs/core@a2b40db9a8 (2026-08-12).
Data as JSON: /api/errors/8243642a5b5ce6ca.
Report an issue: GitHub.