cakephp/cakephp · error · CakeException
Config engine not found when attempting to load .
Error message
Config %s engine not found when attempting to load %s.
What it means
Configure::load() resolves the named configuration engine via Configure::engine($config); if no engine is registered under that name it throws CakeException instead of attempting to load the file. The engine is the adapter (PhpConfig, IniConfig, JsonConfig, etc.) that knows how to read config files.
Solutions
- Register the engine before loading: Configure::config('default', new PhpConfig()); then call Configure::load().
- Check registered engines with Configure::configured() and use an existing name in the second argument of load().
- Fix typos in the engine name argument passed to Configure::load().
Example fix
// before
Configure::load('app', 'default');
// after
if (!in_array('default', Configure::configured(), true)) {
Configure::config('default', new PhpConfig());
}
Configure::load('app', 'default'); Defensive patterns
Strategy: validation
Validate before calling
if (!in_array('default', Configure::configured(), true)) {
Configure::config('default', new Cake\Configure\Engine\PhpConfig());
} Try / catch
try {
Configure::load('app', 'default');
} catch (Cake\Core\Exception\CakeException $e) {
Configure::config('default', new PhpConfig());
Configure::load('app', 'default');
} Prevention
- Register all config engines in bootstrap.php before any load/dump call.
- Use Configure::configured() to assert engine availability in smoke tests.
- Keep engine names as constants shared by registration and usage.
When it happens
Trigger: Configure::load('app', 'default') or Configure::load('app', 'custom') when no engine was registered with Configure::engine('default'/'custom'); calling load before Configure::config() in bootstrap; typo in the engine/config name argument.
Common situations: Copying bootstrap code that registers engines under a different name (e.g. 'default' vs '_cake_core_'); forgetting Configure::config('default', new PhpConfig()) in a standalone/console context; engine registration removed during a framework upgrade.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- There is no ` ` config engine.
- The ` ` cache configuration does not exist.
- Expected configuration key
- You must install cakephp/cache to use Configure::store()
- You must install cakephp/cache to use Configure::restore()
AI-assisted analysis of cakephp/cakephp@1128eba9b0 (2026-09-12).
Data as JSON: /api/errors/08b7ea56754d6acb.
Report an issue: GitHub.
Appendix: source
Thrown at src/Core/Configure.php:330
* ```
* Configure::load('setup', 'default');
* ```
*
* If using `default` config and no engine has been configured for it yet,
* one will be automatically created using PhpConfig
*
* @param string $key name of configuration resource to load.
* @param string $config Name of the configured engine to use to read the resource identified by $key.
* @param bool $merge if config files should be merged instead of simply overridden
* @return bool True if load successful.
* @throws \Cake\Core\Exception\CakeException if the $config engine is not found
* @link https://book.cakephp.org/5/en/development/configuration.html#reading-and-writing-configuration-files
*/
public static function load(string $key, string $config = 'default', bool $merge = true): bool
{
$engine = static::_getEngine($config);
if (!$engine) {
throw new CakeException(
sprintf(
'Config %s engine not found when attempting to load %s.',
$config,
$key,
),
);
}
$values = $engine->read($key);
if ($merge) {
$values = Hash::merge(static::$_values, $values);
}
static::write($values);
return true;
}View on GitHub (pinned to 1128eba9b0)