{"record":{"id":"027a943b2d18983b","repo":"phalcon/cphalcon","slug":"table-completetable-does-not-exist-in-database","errorCode":null,"errorMessage":"Table '{completeTable}' does not exist in database when dumping meta-data for {className}","messagePattern":"Table '(.+?)' does not exist in database when dumping meta-data for (.+?)","errorType":"exception","errorClass":"Phalcon\\Mvc\\Model\\MetaData\\Exceptions\\TableNotInDatabase","httpStatus":null,"severity":"error","filePath":"phalcon/Mvc/Model/MetaData/Strategy/Introspection.zep","lineNumber":89,"sourceCode":"        let schema = model->getSchema(),\n            table  = model->getSource();\n\n        /**\n         * Check if the mapped table exists on the database\n         */\n        let readConnection = model->getReadConnection();\n\n        if unlikely !readConnection->tableExists(table, schema) {\n            if schema {\n                let completeTable = schema . \"'.'\" . table;\n            } else {\n                let completeTable = table;\n            }\n\n            /**\n             * The table not exists\n             */\n            throw new TableNotInDatabase(completeTable, get_class(model));\n        }\n\n        /**\n         * Try to describe the table\n         */\n        let columns = readConnection->describeColumns(table, schema);\n\n        if unlikely empty columns {\n            if schema {\n                let completeTable = schema . \"'.'\" . table;\n            } else {\n                let completeTable = table;\n            }\n\n            /**\n             * The table not exists\n             */\n            throw new CannotObtainTableColumns(completeTable, get_class(model));","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Mvc/Model/MetaData/Strategy/Introspection.zep#L71-L107","documentation":"Introspection::getMetaData() checks readConnection->tableExists() before describing the model's table; when the mapped source/schema does not exist in the database it throws TableNotInDatabase. Usually caused by a wrong getSource()/getSchema(), a missing migration, or connecting to the wrong database.","triggerScenarios":"Thrown at phalcon/Mvc/Model/MetaData/Strategy/Introspection.zep:89 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run database migrations to create the missing table","Correct the model's getSource()/getSchema() return values","Verify the DI 'db' service points to the intended database"],"exampleFix":"try { $metadata = $metaData->getMetaData($model); } catch (TableNotInDatabase $e) { /* run migrations or log misconfiguration */ }","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep migrations in sync with model definitions","Validate table existence in bootstrap/health checks before serving requests"],"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"}