phalcon/cphalcon · error · Phalcon\Di\Exceptions\AliasAlreadyInUse

Alias '{alias}' is already in use by an existing service

Error message

Alias '{alias}' is already in use by an existing service

What it means

Error "Alias '{alias}' is already in use by an existing service" thrown in phalcon/cphalcon.

Source

Thrown at phalcon/Di/Di.zep:674

        var alias, currentAliases, localAliases;

        if (true !== this->has(name)) {
            throw Exception::serviceNotFound(name);
        }

        let currentAliases = this->aliases;
        let localAliases   = aliases;
        if (typeof localAliases !== "array") {
            let localAliases = [localAliases];
        }

        for alias in localAliases {
            if (typeof alias !== "string") {
                throw new AliasNameMustBeString();
            }

            if (true === isset(currentAliases[alias]) || true === this->has(alias)) {
                throw new AliasAlreadyInUse(alias);
            }

            let currentAliases[alias] = name;
        }

        let this->aliases = currentAliases;

        return this;
    }

    /**
     * Set a default dependency injection container to be obtained into static
     * methods
     */
    public static function setDefault(<DiInterface> container) -> void
    {
        let self::defaultContainer = container;
    }

View on GitHub (pinned to b7419de9cd)

When it happens

Trigger: Thrown at phalcon/Di/Di.zep:674 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of phalcon/cphalcon@b7419de9cd (2026-08-21). Data as JSON: /api/errors/c64c5fc6e4ae1e62. Report an issue: GitHub.