{"record":{"id":"50e5937f888294d3","repo":"phalcon/cphalcon","slug":"the-definition-has-setter-injection-parameters-but","errorCode":null,"errorMessage":"The definition has setter injection parameters but the constructor didn't return an instance","messagePattern":"The definition has setter injection parameters but the constructor didn't return an instance","errorType":"exception","errorClass":"Phalcon\\Di\\Exceptions\\SetterInjectionRequiresInstance","httpStatus":null,"severity":"error","filePath":"phalcon/Di/Service/Builder.zep","lineNumber":87,"sourceCode":"            if fetch arguments, definition[\"arguments\"] {\n                /**\n                 * Create the instance based on the parameters\n                 */\n                let instance = create_instance_params(\n                    className,\n                    this->buildParameters(container, arguments)\n                );\n            } else {\n                let instance = create_instance(className);\n            }\n        }\n\n        /**\n         * The definition has calls?\n         */\n        if fetch paramCalls, definition[\"calls\"] {\n            if unlikely typeof instance !== \"object\" {\n                throw new SetterInjectionRequiresInstance();\n            }\n\n            if unlikely typeof paramCalls != \"array\" {\n                throw new SetterParametersMustBeArray();\n            }\n\n            /**\n             * The method call has parameters\n             */\n            for methodPosition, method in paramCalls {\n                /**\n                 * The call parameter must be an array of arrays\n                 */\n                if unlikely typeof method != \"array\" {\n                    throw new MethodCallMustBeArray(methodPosition);\n                }\n\n                /**","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Di/Service/Builder.zep#L69-L105","documentation":"The service definition contains a 'calls' (setter injection) block, but constructing the class did not yield an object (constructor returned null/non-object), so setter methods cannot be invoked on it.","triggerScenarios":"Thrown at phalcon/Di/Service/Builder.zep:87 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the class named in 'className' instantiates to a real object (constructors must not return values)","Remove the 'calls' block if the service is not meant to be setter-injected"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b7419de9cd0a8a3f48441ead84c9f8415d463e25","analyzedAt":"2026-08-21T06:21:18.811Z","contentChangedAt":"2026-08-21T06:21:18.811Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}