{"record":{"id":"ca532db8ea271a81","repo":"phalcon/cphalcon","slug":"no-processor-found-for-the-given-definition","errorCode":null,"errorMessage":"No processor found for the given definition","messagePattern":"No processor found for the given definition","errorType":"exception","errorClass":"Phalcon\\Container\\Exceptions\\NoProcessorFound","httpStatus":null,"severity":"error","filePath":"phalcon/Container/Container.zep","lineNumber":699,"sourceCode":"    /**\n     * Locate a processor\n     *\n     * @param mixed $definition\n     *\n     * @return Processor\n     * @throws NoProcessorFound\n     */\n    private function findProcessor(var definition) -> <Processor>\n    {\n        var processor;\n\n        for processor in this->processors {\n            if (processor->canProcess(definition)) {\n                return processor;\n            }\n        }\n\n        throw new NoProcessorFound();\n    }\n\n    /**\n     * Resolve the service\n     *\n     * @param string $name\n     * @param bool   $cache\n     *\n     * @return mixed\n     * @throws ServiceNotFound\n     * @throws ReflectionException\n     */\n    private function resolve(string name, bool cache) -> mixed\n    {\n        var definition, instance, lifetime;\n\n        if (!array_key_exists(name, this->services)) {\n            if (this->autowire && class_exists(name)) {","sourceCodeStart":681,"sourceCodeEnd":717,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Container/Container.zep#L681-L717","documentation":"set() turns a raw definition into a ServiceDefinition by running an ordered processor list: ObjectProcessor (any non-Closure object), ClosureProcessor, and StringProcessor (a string naming an existing class). NoProcessorFound means the value matched none of these — arrays, int/float/bool scalars, null, resources, and strings that are not loadable class names are all rejected.","triggerScenarios":"$container->set('config', ['app' => [...]]); $container->set('debug', true); or $container->set('logger', 'Monolog\\Logger') when that class does not exist (package not installed, namespace typo); passing a bare string constant like 'db.host'.","commonSituations":"Porting array-style definitions from Phalcon\\Di\\DI register() into the new Container; values that belong in setParameter(); composer dependency missing so class_exists() returns false for a class-name definition.","solutions":["For values and arrays use parameters: $container->setParameter('debug', true)","For class-name strings verify the class exists first: class_exists($class) — fix namespaces or install the package","For computed values pass a closure: $container->set('x', fn () => computeX())","Pre-built objects (any non-Closure object) are accepted as-is and returned on every get()"],"exampleFix":"// before\n$container->set('config', ['debug' => true]); // NoProcessorFound\n\n// after\n$container->setParameter('config', ['debug' => true]);","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"use Closure;\n\nfunction isRegistrableDefinition(mixed $definition): bool\n{\n    if ($definition instanceof Closure) {\n        return true; // ClosureProcessor\n    }\n    if (is_object($definition)) {\n        return true; // ObjectProcessor\n    }\n    return is_string($definition) && class_exists($definition); // StringProcessor\n}\n\n// $container->set('x', $def) only when isRegistrableDefinition($def)","tryCatchPattern":"use Phalcon\\Container\\Exceptions\\NoProcessorFound;\n\ntry {\n    $container->set('debug', true);\n} catch (NoProcessorFound $e) {\n    $container->setParameter('debug', true); // route values to the parameter store\n}","preventionTips":["Only three definition kinds exist: non-Closure object, Closure, and existing-class string — everything else is a parameter","Run class_exists() on class-name definitions in your registration code to fail with your own message","Route arrays/scalars to setParameter() by convention, never set()"],"tags":["di-container","definition","invalid-type","phalcon"],"backgroundTag":"invalid-container-definition","analyzedSha":"b7419de9cd0a8a3f48441ead84c9f8415d463e25","analyzedAt":"2026-08-21T06:21:18.811Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}