{"record":{"id":"ac46dbe19bb15b1a","repo":"bcit-ci/CodeIgniter","slug":"models-path-model-php-exists-but-doesn-t-declare","errorCode":null,"errorMessage":"models/$path$model.php exists, but doesn't declare class $model","messagePattern":"models/\\$path\\$model\\.php exists, but doesn't declare class \\$model","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"system/core/Loader.php","lineNumber":348,"sourceCode":"\n\t\t\t\tlog_message('info', config_item('subclass_prefix').'Model class loaded');\n\t\t\t}\n\t\t}\n\n\t\t$model = ucfirst($model);\n\t\tif ( ! class_exists($model, FALSE))\n\t\t{\n\t\t\tforeach ($this->_ci_model_paths as $mod_path)\n\t\t\t{\n\t\t\t\tif ( ! file_exists($mod_path.'models/'.$path.$model.'.php'))\n\t\t\t\t{\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\trequire_once($mod_path.'models/'.$path.$model.'.php');\n\t\t\t\tif ( ! class_exists($model, FALSE))\n\t\t\t\t{\n\t\t\t\t\tthrow new RuntimeException($mod_path.\"models/\".$path.$model.\".php exists, but doesn't declare class \".$model);\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif ( ! class_exists($model, FALSE))\n\t\t\t{\n\t\t\t\tthrow new RuntimeException('Unable to locate the model you have specified: '.$model);\n\t\t\t}\n\t\t}\n\n\t\tif ( ! is_subclass_of($model, 'CI_Model'))\n\t\t{\n\t\t\tthrow new RuntimeException(\"Class \".$model.\" doesn't extend CI_Model\");\n\t\t}\n\n\t\t$this->_ci_models[] = $name;\n\t\t$model = new $model();","sourceCodeStart":330,"sourceCodeEnd":366,"githubUrl":"https://github.com/bcit-ci/CodeIgniter/blob/3658d731eaabe6117298a105ffb5b9dd59e190ce/system/core/Loader.php#L330-L366","documentation":"Error \"models/$path$model.php exists, but doesn't declare class $model\" thrown in bcit-ci/CodeIgniter.","triggerScenarios":"Thrown at system/core/Loader.php:348 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"}