{"record":{"id":"cc8500a42b98d28f","repo":"octobercms/october","slug":"the-provided-model-class-modelclass-for-the-rec-cc8500","errorCode":null,"errorMessage":"The provided model class \":modelClass\" for the recordfinder is invalid","messagePattern":"The provided model class \":modelClass\" for the recordfinder is invalid","errorType":"exception","errorClass":"SystemException","httpStatus":null,"severity":"error","filePath":"modules/tailor/contentfields/RecordFinderField.php","lineNumber":325,"sourceCode":"        $toTransfer = ['label', 'list', 'form', 'view', 'manage'];\n        foreach ($toTransfer as $transfer) {\n            if (isset($this->controller[$transfer])) {\n                $fieldConfig[$transfer] = is_array($this->controller[$transfer])\n                    ? array_merge($fieldConfig[$transfer], (array) $this->controller[$transfer])\n                    : $this->controller[$transfer];\n            }\n        }\n\n        $field->controller($fieldConfig);\n    }\n\n    /**\n     * getRelatedModel returns the related model to use\n     */\n    protected function getRelatedModel()\n    {\n        if (!class_exists($this->modelClass)) {\n            throw new SystemException(Lang::get('backend::lang.recordfinder.invalid_model_class', ['modelClass' => $this->modelClass]));\n        }\n\n        return new $this->modelClass;\n    }\n}\n","sourceCodeStart":307,"sourceCodeEnd":331,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/tailor/contentfields/RecordFinderField.php#L307-L331","documentation":"Thrown by Tailor's RecordFinder content field when the configured modelClass does not exist as a loadable PHP class. Before rendering the record finder relation, getRelatedModel() calls class_exists($this->modelClass) and aborts with a SystemException if the class cannot be autoloaded. This is a configuration error in the blueprint YAML for a recordfinder field.","triggerScenarios":"Defining a recordfinder content field in a Tailor blueprint whose modelClass value is misspelled, not fully qualified (e.g. Author instead of \\RainLab\\Blog\\Models\\Post), or points to a class in a plugin that is not installed/registered. Also triggered when the record finder relation is used (getRelatedModel is called during relation definition) and the string is empty or names a non-model class.","commonSituations":"Typo in the YAML handle; forgetting the leading backslash or full namespace of the target model; referencing a plugin model after disabling or uninstalling the plugin; renaming a model class without updating blueprints; case-sensitivity differences on Linux (e.g. Post vs post) after developing on Windows/macOS.","solutions":["Check the modelClass value in your blueprint YAML (fields.<name>.modelClass) and correct the spelling to the exact fully qualified class name, e.g. modelClass: \\RainLab\\Blog\\Models\\Post","Verify the class exists and is autoloadable: run php artisan tinker and check class_exists('\\\\Vendor\\\\Plugin\\\\Models\\\\Name')","Confirm the plugin providing the model is installed and enabled (php artisan plugin:list); install or enable it if missing","If you renamed the model class, update every blueprint that references the old name and clear cached blueprint data (php artisan cache:clear, php artisan tailor:sync)"],"exampleFix":"# before (blueprint.yaml)\nfields:\n  posts:\n    type: recordfinder\n    modelClass: RainLab\\Blog\\Models\\Postes   # typo\n\n# after\nfields:\n  posts:\n    type: recordfinder\n    modelClass: \\RainLab\\Blog\\Models\\Post","handlingStrategy":"validation","validationCode":"// Before shipping a blueprint, verify the model class resolves\nuse Illuminate\\Support\\Arr;\n\n$modelClass = Arr::get($fieldConfig, 'modelClass');\nif (!class_exists($modelClass)) {\n    throw new InvalidArgumentException(\"recordfinder modelClass [{$modelClass}] does not exist\");\n}","typeGuard":"function isValidRecordFinderModel(?string $modelClass): bool\n{\n    return $modelClass !== null && class_exists($modelClass)\n        && is_subclass_of($modelClass, \\October\\Rain\\Database\\Model::class);\n}","tryCatchPattern":null,"preventionTips":["Add a CI or deploy-time lint that walks blueprint YAML files and asserts class_exists() on every modelClass value","Keep a project convention of always using fully qualified class names with leading backslash in modelClass","Re-run the lint after renaming or moving any model class"],"tags":["tailor","octobercms","recordfinder","blueprint","model-class","configuration"],"backgroundTag":"class-not-found","analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}