{"record":{"id":"669028ed88bd8f5f","repo":"phalcon/cphalcon","slug":"you-must-provide-filepath-option-in-factory-conf","errorCode":null,"errorMessage":"You must provide 'filePath' option in factory config parameter.","messagePattern":"You must provide 'filePath' option in factory config parameter\\.","errorType":"exception","errorClass":"Phalcon\\Config\\Exceptions\\MissingConfigOption","httpStatus":null,"severity":"error","filePath":"phalcon/Config/ConfigFactory.zep","lineNumber":223,"sourceCode":"\n        if typeof config !== \"array\" {\n            throw new ConfigNotArrayOrObject();\n        }\n\n        this->checkConfigArray(config);\n\n        return config;\n    }\n\n    /**\n     * @param array $config\n     *\n     * @throws Exception\n     */\n    private function checkConfigArray(array config) -> void\n    {\n        if true !== isset(config[\"filePath\"]) {\n            throw new MissingConfigOption(\"filePath\");\n        }\n\n        if true !== isset(config[\"adapter\"]) {\n            throw new MissingConfigOption(\"adapter\");\n        }\n    }\n}\n","sourceCodeStart":205,"sourceCodeEnd":231,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Config/ConfigFactory.zep#L205-L231","documentation":"When the factory config is given as an array, checkConfigArray() requires a 'filePath' key before any adapter is constructed. If it is absent, MissingConfigOption('filePath') is thrown — the message names the exact missing option.","triggerScenarios":"$factory->load(['adapter' => 'ini']) with no filePath; keys named 'file', 'path', or snake_case 'file_path' are not recognized and the check still fails.","commonSituations":"Porting config arrays written for other Phalcon factories with different key names; camelCase vs snake_case mismatch in configs migrated from older setups; a key silently dropped during array merging.","solutions":["Use exactly 'filePath' (camelCase) together with 'adapter'","Validate keys with array_key_exists('filePath', $config) before calling load()","When migrating from Phalcon 3-era configs, rename snake_case keys to camelCase"],"exampleFix":"// before\n$config = $factory->load(['adapter' => 'ini', 'file_path' => '/etc/app.ini']);\n\n// after\n$config = $factory->load([\n    'adapter'  => 'ini',\n    'filePath' => '/etc/app.ini',\n]);","handlingStrategy":"validation","validationCode":"foreach (['filePath', 'adapter'] as $key) {\n    if (!array_key_exists($key, $configArray)) {\n        throw new InvalidArgumentException(\n            sprintf('ConfigFactory config is missing the \"%s\" key', $key)\n        );\n    }\n}\n$config = $factory->load($configArray);","typeGuard":null,"tryCatchPattern":"try {\n    $config = $factory->load($configArray);\n} catch (\\Phalcon\\Config\\ConfigFactory\\Exception\\MissingConfigOption $e) {\n    // Message names the missing option ('filePath'); supply it and retry\n    $configArray['filePath'] ??= '/etc/myapp/config.ini';\n    $config = $factory->load($configArray);\n}","preventionTips":["Use exact camelCase keys: 'filePath' and 'adapter'","Validate both keys with array_key_exists() before load() when configs come from files or other teams","When migrating older configs, rename snake_case variants (file_path) to camelCase"],"tags":["phalcon","config","factory","missing-option","configuration"],"backgroundTag":"config-validation-failed","analyzedSha":"b7419de9cd0a8a3f48441ead84c9f8415d463e25","analyzedAt":"2026-08-21T06:21:18.811Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}