{"record":{"id":"8243642a5b5ce6ca","repo":"vuejs/core","slug":"key-compat-has-been-disabled","errorCode":null,"errorMessage":"${key} compat has been disabled.","messagePattern":"(.+?) compat has been disabled\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/runtime-core/src/compat/compatConfig.ts","lineNumber":599,"sourceCode":"    : rawMode\n\n  if (mode === 2) {\n    return val !== false\n  } else {\n    return val === true || val === 'suppress-warning'\n  }\n}\n\n/**\n * Use this for features that are completely removed in non-compat build.\n */\nexport function assertCompatEnabled(\n  key: DeprecationTypes,\n  instance: ComponentInternalInstance | null,\n  ...args: any[]\n): void {\n  if (!isCompatEnabled(key, instance)) {\n    throw new Error(`${key} compat has been disabled.`)\n  } else if (__DEV__) {\n    warnDeprecation(key, instance, ...args)\n  }\n}\n\n/**\n * Use this for features where legacy usage is still possible, but will likely\n * lead to runtime error if compat is disabled. (warn in all cases)\n */\nexport function softAssertCompatEnabled(\n  key: DeprecationTypes,\n  instance: ComponentInternalInstance | null,\n  ...args: any[]\n): boolean {\n  if (__DEV__) {\n    warnDeprecation(key, instance, ...args)\n  }\n  return isCompatEnabled(key, instance)","sourceCodeStart":581,"sourceCodeEnd":617,"githubUrl":"https://github.com/vuejs/core/blob/a2b40db9a83b36ed9da3a16403cf8f040262d73f/packages/runtime-core/src/compat/compatConfig.ts#L581-L617","documentation":"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.`","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nimport { configureCompat } from 'vue'\nconfigureCompat({ MODE: 3, RENDER_FUNCTION: false })\n// ... code still uses the removed render-function compat path\n\n// after\nconfigureCompat({ MODE: 2, RENDER_FUNCTION: true })\n// or migrate the call site to the v3 API, then drop the flag","handlingStrategy":"validation","validationCode":"// Before using a removed Vue 2 feature, check compat is enabled.\nimport { isCompatEnabled } from 'vue/compat'\nimport { DeprecationTypes } from 'vue/compat'\nfunction guardedFilterUsage(key = DeprecationTypes.FILTERS) {\n  if (!isCompatEnabled(key, null)) {\n    throw new Error(`${key} requires compat enabled; migrate to a method/computed.`)\n  }\n  // ... legacy filter usage\n}","typeGuard":"function compatFeatureEnabled(key: number, instance: any): boolean {\n  return isCompatEnabled(key, instance)\n}","tryCatchPattern":"try {\n  assertCompatEnabled(DeprecationTypes.FILTERS, instance)\n  // ... legacy code path\n} catch (e) {\n  // migrate the call site, or re-enable the feature in configureCompat\n  throw e\n}","preventionTips":["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."],"tags":["vue","runtime-core","migration-build","compat","deprecation","configuration"],"backgroundTag":null,"analyzedSha":"a2b40db9a83b36ed9da3a16403cf8f040262d73f","analyzedAt":"2026-08-12T14:21:14.989Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}