{"record":{"id":"dd0915a1b8fbe1b1","repo":"moodle/moodle","slug":"entry-s-cannot-be-compiled-invokable-classes-cannot-be","errorCode":null,"errorMessage":"Entry \"%s\" cannot be compiled. Invokable classes cannot be automatically resolved if autowiring is disabled on the container, you need to enable autowiring or define the entry","messagePattern":"Entry \"(.+?)\" cannot be compiled\\. Invokable classes cannot be automatically resolved if autowiring is disabled on the container, you need to enable autowiring or define the entry","errorType":"exception","errorClass":"InvalidDefinition","httpStatus":null,"severity":"error","filePath":"public/lib/php-di/php-di/src/Compiler/Compiler.php","lineNumber":273,"sourceCode":"                    }\n                    throw new InvalidDefinition(sprintf(\n                        'Entry \"%s\" decorates nothing: no previous definition with the same name was found',\n                        $definition->getName()\n                    ));\n                }\n                $code = sprintf(\n                    'return call_user_func(%s, %s, $this->delegateContainer);',\n                    $this->compileValue($definition->getCallable()),\n                    $this->compileValue($decoratedDefinition)\n                );\n                break;\n            case $definition instanceof FactoryDefinition:\n                $value = $definition->getCallable();\n\n                // Custom error message to help debugging\n                $isInvokableClass = is_string($value) && class_exists($value) && method_exists($value, '__invoke');\n                if ($isInvokableClass && !$this->autowiringEnabled) {\n                    throw new InvalidDefinition(sprintf(\n                        'Entry \"%s\" cannot be compiled. Invokable classes cannot be automatically resolved if autowiring is disabled on the container, you need to enable autowiring or define the entry manually.',\n                        $entryName\n                    ));\n                }\n\n                $definitionParameters = '';\n                if (!empty($definition->getParameters())) {\n                    $definitionParameters = ', ' . $this->compileValue($definition->getParameters());\n                }\n\n                $code = sprintf(\n                    'return $this->resolveFactory(%s, %s%s);',\n                    $this->compileValue($value),\n                    var_export($entryName, true),\n                    $definitionParameters\n                );\n\n                break;","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/moodle/moodle/blob/48ea8c33227277e916cdd4079dbecef448b37f2c/public/lib/php-di/php-di/src/Compiler/Compiler.php#L255-L291","documentation":"Error \"Entry \"%s\" cannot be compiled. Invokable classes cannot be automatically resolved if autowiring is disabled on the container, you need to enable autowiring or define the entry\" thrown in moodle/moodle.","triggerScenarios":"Thrown at public/lib/php-di/php-di/src/Compiler/Compiler.php:273 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Enable autowiring on the container so invokable classes can be resolved","Define the entry explicitly (object definition or factory) instead of relying on autowiring"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"48ea8c33227277e916cdd4079dbecef448b37f2c","analyzedAt":"2026-09-14T20:34:48.527Z","contentChangedAt":"2026-09-14T20:34:48.527Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}