{"record":{"id":"a21f2579c29bb4b7","repo":"phalcon/cphalcon","slug":"parameter-name-not-found","errorCode":null,"errorMessage":"Parameter '{name}' not found","messagePattern":"Parameter '(.+?)' not found","errorType":"exception","errorClass":"Phalcon\\Container\\Exceptions\\ParameterNotFound","httpStatus":null,"severity":"error","filePath":"phalcon/Container/Container.zep","lineNumber":286,"sourceCode":"        if (!array_key_exists(name, this->instances)) {\n            throw new InstanceNotFound(name);\n        }\n\n        return this->instances[name];\n    }\n\n    /**\n     * Return a parameter\n     *\n     * @param string $name\n     *\n     * @return mixed\n     * @throws ParameterNotFound\n     */\n    public function getParameter(string name) -> mixed\n    {\n        if (!array_key_exists(name, this->parameters)) {\n            throw new ParameterNotFound(name);\n        }\n\n        return this->resolveParameter(name);\n    }\n\n    /**\n     * Return the resolver\n     *\n     * @return Resolver\n     */\n    public function getResolver() -> <Resolver>\n    {\n        return this->resolver;\n    }\n\n    /**\n     * Resolve an return a service\n     *","sourceCodeStart":268,"sourceCodeEnd":304,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Container/Container.zep#L268-L304","documentation":"Parameters live in a separate store from services. getParameter() does a plain key lookup in that store and throws ParameterNotFound when the key was never set with setParameter(). There is no fallback to config files, environment variables, or service names.","triggerScenarios":"Calling $container->getParameter('db.host') without a prior setParameter('db.host', ...); typo or case mismatch in the key; parameters being loaded inside a ServiceProvider that has not run yet; expecting nested/dotted access to work.","commonSituations":"Config wiring where setParameter() calls live in a provider executed later in bootstrap; renamed config keys after refactoring; assuming getParameter() merges environment or Config values (it does not).","solutions":["Set it first: $container->setParameter('db.host', $config->path('db.host'))","Guard with $container->hasParameter('db.host') before reading, or with a default: $container->hasParameter(...) ? $container->getParameter(...) : $default","For environment-backed values, inject a Lazy\\Env object as a service argument instead of reading a parameter","Check exact key spelling — lookup is case-sensitive with no nested traversal"],"exampleFix":"// before\n$host = $container->getParameter('dbhost'); // ParameterNotFound\n\n// after\n$host = $container->hasParameter('dbhost')\n    ? $container->getParameter('dbhost')\n    : $container->getParameter('db.host');","handlingStrategy":"validation","validationCode":"$host = $container->hasParameter('db.host')\n    ? $container->getParameter('db.host')\n    : 'localhost';","typeGuard":null,"tryCatchPattern":"use Phalcon\\Container\\Exceptions\\ParameterNotFound;\n\ntry {\n    $host = $container->getParameter('db.host');\n} catch (ParameterNotFound $e) {\n    $host = $_ENV['DB_HOST'] ?? 'localhost';\n}","preventionTips":["Register all parameters in one provider that runs first during bootstrap","Keep parameter keys in one constants class shared by writer and reader code","Use Lazy\\Env for environment-backed values instead of duplicating them as parameters"],"tags":["di-container","parameters","configuration","phalcon"],"backgroundTag":"missing-config-key","analyzedSha":"b7419de9cd0a8a3f48441ead84c9f8415d463e25","analyzedAt":"2026-08-21T06:21:18.811Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}