{"record":{"id":"ef1ba26f83e1105f","repo":"phalcon/cphalcon","slug":"cannot-build-the-query-invalid-condition","errorCode":null,"errorMessage":"Cannot build the query. Invalid condition","messagePattern":"Cannot build the query\\. Invalid condition","errorType":"exception","errorClass":"BuilderConditionInvalid","httpStatus":null,"severity":"error","filePath":"phalcon/Mvc/Model/Query/Builder.zep","lineNumber":731,"sourceCode":"            if unlikely empty models {\n                throw new ModelRequired();\n            }\n        } else {\n            if unlikely !models {\n                throw new ModelRequired();\n            }\n        }\n\n        let conditions = this->conditions;\n\n        if is_numeric(conditions) {\n            /**\n             * If the conditions is a single numeric field. We internally create\n             * a condition using the related primary key\n             */\n            if typeof models == \"array\" {\n                if unlikely count(models) > 1 {\n                    throw new BuilderConditionInvalid();\n                }\n\n                let model = models[0];\n            } else {\n                let model = models;\n            }\n\n            /**\n             * Get the models metadata service to obtain the column names,\n             * column map and primary key\n             */\n            let metaData      = container->getShared(\"modelsMetadata\"),\n                modelInstance = create_instance_params(\n                    model,\n                    [\n                        null,\n                        container\n                    ]","sourceCodeStart":713,"sourceCodeEnd":749,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Mvc/Model/Query/Builder.zep#L713-L749","documentation":"Error \"Cannot build the query. Invalid condition\" thrown in phalcon/cphalcon.","triggerScenarios":"Thrown at phalcon/Mvc/Model/Query/Builder.zep:731 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"}