{"record":{"id":"76d73c62f2e517ed","repo":"phalcon/cphalcon","slug":"the-model-model-does-not-have-the-attribute","errorCode":null,"errorMessage":"The model '{model}' does not have the attribute '{attribute}', when preparing: {phql}","messagePattern":"The model '(.+?)' does not have the attribute '(.+?)', when preparing: (.+?)","errorType":"exception","errorClass":"MissingModelAttribute","httpStatus":null,"severity":"error","filePath":"phalcon/Mvc/Model/Query.zep","lineNumber":3865,"sourceCode":"            ];\n        }\n\n        let sqlInsert = [\n            \"model\": modelName,\n            \"table\": source\n        ];\n\n        let metaData = this->metaData;\n\n        if fetch fields, ast[\"fields\"] {\n            let sqlFields = [];\n\n            for field in fields {\n                let name = field[\"name\"];\n\n                // Check that inserted fields are part of the model\n                if unlikely !metaData->hasAttribute(model, name) {\n                    throw new MissingModelAttribute(modelName, name, this->phql);\n                }\n\n                // Add the file to the insert list\n                let sqlFields[] = name;\n            }\n\n            let sqlInsert[\"fields\"] = sqlFields;\n        }\n\n        let sqlInsert[\"values\"] = exprValues;\n\n        return sqlInsert;\n    }\n\n    /**\n     * Analyzes a SELECT intermediate code and produces an array to be executed later\n     */\n    final protected function prepareSelect(var ast = null, bool merge = false) -> array","sourceCodeStart":3847,"sourceCodeEnd":3883,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Mvc/Model/Query.zep#L3847-L3883","documentation":"Error \"The model '{model}' does not have the attribute '{attribute}', when preparing: {phql}\" thrown in phalcon/cphalcon.","triggerScenarios":"Thrown at phalcon/Mvc/Model/Query.zep:3865 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"}