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

The definition has properties injection parameters but the…

Error message

The definition has properties injection parameters but the constructor didn't return an instance

What it means

Thrown by Builder::build when the definition contains a 'properties' key but the constructor step did not yield an object instance (e.g. className resolved to a non-instantiable result), so property injection has no target. Ensure the definition produces a valid instance before using property injection.

Solutions

  1. Ensure 'className' resolves to an instantiable class returning a real object
  2. Remove the 'properties' block if property injection is not intended
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at phalcon/Di/Service/Builder.zep:150 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/a0e8e3a83df04384. Report an issue: GitHub.

Appendix: source

Thrown at phalcon/Di/Service/Builder.zep:150

                         * Go to next method call
                         */
                        continue;
                    }
                }

                /**
                 * Call the method on the instance without arguments
                 */
                call_user_func(methodCall);
            }
        }

        /**
         * The definition has properties?
         */
        if fetch paramCalls, definition["properties"] {
            if unlikely typeof instance !== "object" {
                throw new PropertyInjectionRequiresInstance();
            }

            if unlikely typeof paramCalls !== "array" {
                throw new SetterParametersMustBeArray();
            }

            /**
             * The method call has parameters
             */
            for propertyPosition, property in paramCalls {
                /**
                 * The call parameter must be an array of arrays
                 */
                if unlikely typeof property != "array" {
                    throw new PropertyMustBeArray(propertyPosition);
                }

                /**

View on GitHub (pinned to b7419de9cd)