{"record":{"id":"97a4b4bf5c65023d","repo":"phalcon/cphalcon","slug":"the-injected-service-modelsmetadata-is-not-valid","errorCode":null,"errorMessage":"The injected service 'modelsMetadata' is not valid in '{className}'","messagePattern":"The injected service 'modelsMetadata' is not valid in '(.+?)'","errorType":"exception","errorClass":"Phalcon\\Mvc\\Model\\Exceptions\\InvalidModelsMetadataService","httpStatus":null,"severity":"error","filePath":"phalcon/Mvc/Model.zep","lineNumber":2238,"sourceCode":"    /**\n     * {@inheritdoc}\n     */\n    public function getModelsMetaData() -> <MetaDataInterface>\n    {\n        var metaData, container;\n\n        let metaData = this->modelsMetaData;\n\n        if metaData === null {\n            let container = <DiInterface> this->container;\n\n            /**\n             * Obtain the models-metadata service from the DI\n             */\n            let metaData = <MetaDataInterface> container->getShared(\"modelsMetadata\");\n\n            if unlikely typeof metaData != \"object\" {\n                throw new InvalidModelsMetadataService(get_class(this));\n            }\n\n            /**\n             * Update the models-metadata property\n             */\n            let this->modelsMetaData = metaData;\n        }\n\n        return metaData;\n    }\n\n    /**\n     * Returns the type of the latest operation performed by the ORM\n     * Returns one of the OP_* class constants\n     */\n    public function getOperationMade() -> int\n    {\n        return this->operationMade;","sourceCodeStart":2220,"sourceCodeEnd":2256,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Mvc/Model.zep#L2220-L2256","documentation":"Error \"The injected service 'modelsMetadata' is not valid in '{className}'\" thrown in phalcon/cphalcon.","triggerScenarios":"Thrown at phalcon/Mvc/Model.zep:2238 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b7419de9cd0a8a3f48441ead84c9f8415d463e25","analyzedAt":"2026-08-21T06:21:18.811Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}