octobercms/october · error · Error

Missing an element with data-vue-template

Error message

Missing an element with data-vue-template

What it means

initContainerInternal looks for a descendant with the data-vue-template attribute to mount the Vue app; absence means the control's markup doesn't include the template node, so the Vue container cannot be created during connectAfter.

Solutions

  1. Add an element with data-vue-template inside the control's markup
  2. Verify the template partial isn't empty or conditionally removed
  3. Check the selector context — the template must be a descendant of this.element
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at modules/backend/assets/js/vueapp/vue-control-base.js:48 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21). Data as JSON: /api/errors/08812bde2d2253fc. Report an issue: GitHub.

Appendix: source

Thrown at modules/backend/assets/js/vueapp/vue-control-base.js:48

    connectAfter() {
        this.vueContainerInstance = this;
        super.connectAfter();
        this.initContainerInternal();
    }

    disconnectAfter() {
        this.destroyContainerInternal();
        super.disconnectAfter();
        this.vueContainerInstance = null;
    }

    // Internals

    initContainerInternal() {
        this.vueElement = this.element.querySelector('[data-vue-template]');
        if (!this.vueElement) {
            throw new Error('Missing an element with data-vue-template');
        }

        oc.pageReady().then(() => {
            this.app.createContainer(this, this.vueElement);
        });
    }

    destroyContainerInternal() {
        this.app.destroyContainer(this);
    }
}

oc.registerControl('vue-container', VueControlBase);

// Global for backward compatibility
oc.VueControlBase = VueControlBase;

export default VueControlBase;

View on GitHub (pinned to b608633a7e)