{"record":{"id":"9d94153c8f8cca49","repo":"phalcon/cphalcon","slug":"alias-name-is-used-more-than-once-when-prepar","errorCode":null,"errorMessage":"Alias '{name}' is used more than once, when preparing: {phql}","messagePattern":"Alias '(.+?)' is used more than once, when preparing: (.+?)","errorType":"exception","errorClass":"DuplicateAlias","httpStatus":null,"severity":"error","filePath":"phalcon/Mvc/Model/Query.zep","lineNumber":4013,"sourceCode":"            // Define a complete schema/source\n            let schema = model->getSchema(),\n                source = model->getSource();\n\n            // Obtain the real source including the schema\n            if schema {\n                let completeSource = [source, schema];\n            } else {\n                let completeSource = source;\n            }\n\n            /**\n             * If an alias is defined for a model then the model cannot be\n             * referenced in the column list\n             */\n            if fetch alias, selectedModel[\"alias\"] {\n                // Check if the alias was used before\n                if unlikely isset sqlAliases[alias] {\n                    throw new DuplicateAlias(alias, this->phql);\n                }\n\n                let sqlAliases[alias] = alias,\n                    sqlAliasesModels[alias] = modelName,\n                    sqlModelsAliases[modelName] = alias,\n                    sqlAliasesModelsInstances[alias] = model;\n\n                /**\n                 * Append or convert complete source to an array\n                 */\n                if typeof completeSource == \"array\" {\n                    let completeSource[] = alias;\n                } else {\n                    let completeSource = [source, null, alias];\n                }\n\n                let models[modelName] = alias;\n            } else {","sourceCodeStart":3995,"sourceCodeEnd":4031,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Mvc/Model/Query.zep#L3995-L4031","documentation":"Error \"Alias '{name}' is used more than once, when preparing: {phql}\" thrown in phalcon/cphalcon.","triggerScenarios":"Thrown at phalcon/Mvc/Model/Query.zep:4013 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"}