{"record":{"id":"08b7ea56754d6acb","repo":"cakephp/cakephp","slug":"config-s-engine-not-found-when-attempting-to-load-s","errorCode":null,"errorMessage":"Config %s engine not found when attempting to load %s.","messagePattern":"Config (.+?) engine not found when attempting to load (.+?)\\.","errorType":"exception","errorClass":"CakeException","httpStatus":null,"severity":"error","filePath":"src/Core/Configure.php","lineNumber":330,"sourceCode":"     * ```\n     * Configure::load('setup', 'default');\n     * ```\n     *\n     * If using `default` config and no engine has been configured for it yet,\n     * one will be automatically created using PhpConfig\n     *\n     * @param string $key name of configuration resource to load.\n     * @param string $config Name of the configured engine to use to read the resource identified by $key.\n     * @param bool $merge if config files should be merged instead of simply overridden\n     * @return bool True if load successful.\n     * @throws \\Cake\\Core\\Exception\\CakeException if the $config engine is not found\n     * @link https://book.cakephp.org/5/en/development/configuration.html#reading-and-writing-configuration-files\n     */\n    public static function load(string $key, string $config = 'default', bool $merge = true): bool\n    {\n        $engine = static::_getEngine($config);\n        if (!$engine) {\n            throw new CakeException(\n                sprintf(\n                    'Config %s engine not found when attempting to load %s.',\n                    $config,\n                    $key,\n                ),\n            );\n        }\n\n        $values = $engine->read($key);\n\n        if ($merge) {\n            $values = Hash::merge(static::$_values, $values);\n        }\n\n        static::write($values);\n\n        return true;\n    }","sourceCodeStart":312,"sourceCodeEnd":348,"githubUrl":"https://github.com/cakephp/cakephp/blob/1128eba9b09f1946df684811350e26f2cef68fac/src/Core/Configure.php#L312-L348","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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()."],"exampleFix":"// before\nConfigure::load('app', 'default');\n// after\nif (!in_array('default', Configure::configured(), true)) {\n    Configure::config('default', new PhpConfig());\n}\nConfigure::load('app', 'default');","handlingStrategy":"validation","validationCode":"if (!in_array('default', Configure::configured(), true)) {\n    Configure::config('default', new Cake\\Configure\\Engine\\PhpConfig());\n}","typeGuard":null,"tryCatchPattern":"try {\n    Configure::load('app', 'default');\n} catch (Cake\\Core\\Exception\\CakeException $e) {\n    Configure::config('default', new PhpConfig());\n    Configure::load('app', 'default');\n}","preventionTips":["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."],"tags":["configuration","engine-not-registered","cakephp"],"backgroundTag":"resource-not-found","analyzedSha":"1128eba9b09f1946df684811350e26f2cef68fac","analyzedAt":"2026-09-12T12:07:00.388Z","contentChangedAt":"2026-09-12T12:07:00.388Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}