phalcon/cphalcon · error · Phalcon\Mvc\Model\Exceptions\ModelCouldNotLoad
Model ' ' could not be loaded
Error message
Model '{modelName}' could not be loaded What it means
Thrown by ModelsManager::load when class_exists() fails for the given model name — the class cannot be autoloaded, usually because of a typo, a missing namespace, or the file/composer mapping for the model is absent.
Solutions
- Correct the model name string, including its full namespace
- Check composer.json autoload PSR-4 mappings cover the model's directory
- Ensure the model file exists and the autoloader is registered before calling load()
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at phalcon/Mvc/Model/Manager.zep:2022 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of phalcon/cphalcon@b7419de9cd (2026-08-21).
Data as JSON: /api/errors/5f5264d20d257f0a.
Report an issue: GitHub.
Appendix: source
Thrown at phalcon/Mvc/Model/Manager.zep:2022
let this->keepSnapshots[get_class_lower(model)] = keepSnapshots;
}
/**
* Loads a model throwing an exception if it does not exist
*
* @param string $modelName
*
* @return ModelInterface
*/
public function load( string modelName) -> <ModelInterface>
{
var model;
/**
* The model does not exist throw an exception
*/
if unlikely !class_exists(modelName) {
throw new ModelCouldNotLoad(modelName);
}
/**
* Load it using an autoloader
*/
let model = create_instance_params(
modelName,
[
null,
this->container,
this
]
);
return model;
}
/**View on GitHub (pinned to b7419de9cd)