{"record":{"id":"205c95e64378b50c","repo":"bcit-ci/CodeIgniter","slug":"model-php-exists-but-doesn-t-declare-class-ci-mod","errorCode":null,"errorMessage":"Model.php exists, but doesn't declare class CI_Model","messagePattern":"Model\\.php exists, but doesn't declare class CI_Model","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"system/core/Loader.php","lineNumber":312,"sourceCode":"\t\t}\n\n\t\t// Note: All of the code under this condition used to be just:\n\t\t//\n\t\t//       load_class('Model', 'core');\n\t\t//\n\t\t//       However, load_class() instantiates classes\n\t\t//       to cache them for later use and that prevents\n\t\t//       MY_Model from being an abstract class and is\n\t\t//       sub-optimal otherwise anyway.\n\t\tif ( ! class_exists('CI_Model', FALSE))\n\t\t{\n\t\t\t$app_path = APPPATH.'core'.DIRECTORY_SEPARATOR;\n\t\t\tif (file_exists($app_path.'Model.php'))\n\t\t\t{\n\t\t\t\trequire_once($app_path.'Model.php');\n\t\t\t\tif ( ! class_exists('CI_Model', FALSE))\n\t\t\t\t{\n\t\t\t\t\tthrow new RuntimeException($app_path.\"Model.php exists, but doesn't declare class CI_Model\");\n\t\t\t\t}\n\n\t\t\t\tlog_message('info', 'CI_Model class loaded');\n\t\t\t}\n\t\t\telseif ( ! class_exists('CI_Model', FALSE))\n\t\t\t{\n\t\t\t\trequire_once(BASEPATH.'core'.DIRECTORY_SEPARATOR.'Model.php');\n\t\t\t}\n\n\t\t\t$class = config_item('subclass_prefix').'Model';\n\t\t\tif (file_exists($app_path.$class.'.php'))\n\t\t\t{\n\t\t\t\trequire_once($app_path.$class.'.php');\n\t\t\t\tif ( ! class_exists($class, FALSE))\n\t\t\t\t{\n\t\t\t\t\tthrow new RuntimeException($app_path.$class.\".php exists, but doesn't declare class \".$class);\n\t\t\t\t}\n","sourceCodeStart":294,"sourceCodeEnd":330,"githubUrl":"https://github.com/bcit-ci/CodeIgniter/blob/3658d731eaabe6117298a105ffb5b9dd59e190ce/system/core/Loader.php#L294-L330","documentation":"Error \"Model.php exists, but doesn't declare class CI_Model\" thrown in bcit-ci/CodeIgniter.","triggerScenarios":"Thrown at system/core/Loader.php:312 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":"3658d731eaabe6117298a105ffb5b9dd59e190ce","analyzedAt":"2026-08-17T02:34:56.929Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}