vuejs/devtools-v6 · info
on.getComponentInstances is not implemented for Vue 2
Error message
on.getComponentInstances is not implemented for Vue 2
What it means
The Vue 2 backend registers a handler for the `api.on.getComponentInstances` devtools event, but Vue 2's internals do not expose a supported way to retrieve all component instances for that API, so the handler only logs this warning. The devtools feature requesting instances gets no data. It is expected behavior on Vue 2 apps, not a bug.
Source
Thrown at packages/app-backend-vue2/src/index.ts:75
api.on.editComponentState((payload) => {
editState(payload, api.stateEditor)
})
api.on.getComponentRootElements((payload) => {
payload.rootElements = getRootElementsFromComponentInstance(payload.componentInstance)
})
api.on.getComponentDevtoolsOptions((payload) => {
payload.options = payload.componentInstance.$options.devtools
})
api.on.getComponentRenderCode((payload) => {
payload.code = payload.componentInstance.$options.render.toString()
})
api.on.getComponentInstances(() => {
console.warn('on.getComponentInstances is not implemented for Vue 2')
})
},
setupApp(api, appRecord) {
const { Vue } = appRecord.options.meta
const app = appRecord.options.app
// State editor overrides
api.stateEditor.createDefaultSetCallback = (state) => {
return (obj, field, value) => {
if (state.remove || state.newKey) {
Vue.delete(obj, field)
}
if (!state.remove) {
Vue.set(obj, state.newKey || field, value)
}
}
}View on GitHub (pinned to dd2ab5d427)
Solutions
- Accept the limitation: this API is Vue 3-only; access Vue 2 instances via appRecord options (`appRecord.options.app`) or the root instance's `$children` traversal instead.
- Feature-detect: check the backend/major version before calling getComponentInstances and skip the call for Vue 2.
- If you need instance lists in Vue 2 tooling, walk the component tree from the root instance yourself.
- Migrate the app to Vue 3 if full devtools API parity is required.
Example fix
// before
api.on.getComponentInstances(cb) // warns on Vue 2
// after
if (appRecord.options.meta.Vue.version.startsWith('3')) {
api.on.getComponentInstances(cb)
} else {
const root = appRecord.options.app
const walk = c => { cb([c]); c.$children.forEach(walk) }
walk(root)
} Defensive patterns
Strategy: type-guard
Validate before calling
const isVue2 = appRecord.options.meta.Vue.version.startsWith('2')
if (!isVue2) api.on.getComponentInstances(cb) Type guard
function isVue3App(appRecord) { return appRecord.options.meta.Vue.version.startsWith('3') } Prevention
- Feature-check the Vue major version before using getComponentInstances
- For Vue 2, traverse instances from the root via $children instead
- Expect partial API parity on Vue 2 backends
When it happens
Trigger: Any devtools frontend/extension feature calling getComponentInstances while connected to an app running the app-backend-vue2 backend (Vue 2.x app).
Common situations: Using devtools features designed for Vue 3 (component instance listing for custom panels, open-in-editor flows) against a Vue 2 app; plugin authors calling the API expecting Vue 3 parity.
Related errors
- [Vue Devtools] No hook in parent window
- [Vue Devtools] No routes found in router
- Inspector ${inspectorId} not found
AI-assisted analysis of vuejs/devtools-v6@dd2ab5d427 (2026-08-31).
Data as JSON: /api/errors/7bc6360989d29997.
Report an issue: GitHub.