bettercap/bettercap · error

Cannot activate an already activated outlet

Error message

Cannot activate an already activated outlet

What it means

Guard inside Angular's RouterOutlet.activate: thrown when the outlet is instructed to activate a component while this.activated already holds a live component instance. This happens when routing configuration re-triggers activation (e.g. duplicate route definitions or a broken RouteReuseStrategy) without the previous component being deactivated/destroyed first.

Source

Thrown at modules/ui/ui/vendor.js:79755

     * Called when the `RouteReuseStrategy` instructs to re-attach a previously detached subtree
     */
    RouterOutlet.prototype.attach = function (ref, activatedRoute) {
        this.activated = ref;
        this._activatedRoute = activatedRoute;
        this.location.insert(ref.hostView);
    };
    RouterOutlet.prototype.deactivate = function () {
        if (this.activated) {
            var c = this.component;
            this.activated.destroy();
            this.activated = null;
            this._activatedRoute = null;
            this.deactivateEvents.emit(c);
        }
    };
    RouterOutlet.prototype.activateWith = function (activatedRoute, resolver) {
        if (this.isActivated) {
            throw new Error('Cannot activate an already activated outlet');
        }
        this._activatedRoute = activatedRoute;
        var snapshot = activatedRoute._futureSnapshot;
        var component = snapshot.routeConfig.component;
        resolver = resolver || this.resolver;
        var factory = resolver.resolveComponentFactory(component);
        var childContexts = this.parentContexts.getOrCreateContext(this.name).children;
        var injector = new OutletInjector(activatedRoute, childContexts, this.location.injector);
        this.activated = this.location.createComponent(factory, this.location.length, injector);
        // Calling `markForCheck` to make sure we will run the change detection when the
        // `RouterOutlet` is inside a `ChangeDetectionStrategy.OnPush` component.
        this.changeDetector.markForCheck();
        this.activateEvents.emit(this.activated.instance);
    };
    Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
        Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Output"])('activate'),
        Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Object)
    ], RouterOutlet.prototype, "activateEvents", void 0);

View on GitHub (pinned to 8eca2820f3)

Solutions

  1. Check for duplicate router-outlet elements or route configurations that resolve two activations to the same outlet
  2. Ensure custom RouteReuseStrategy implementations correctly pair shouldAttach/retrieve with detach, and that detached handles are cleared
  3. Verify you are not manually calling activate() or re-inserting views created by the outlet
  4. Report to maintainers if it occurs on a stock configuration with route params only changing; it may be a framework bug
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at modules/ui/ui/vendor.js:79755 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of bettercap/bettercap@8eca2820f3 (2026-09-02). Data as JSON: /api/errors/c6b04c20a818707c. Report an issue: GitHub.