{"record":{"id":"e09ac0a7020ee400","repo":"octobercms/october","slug":"the-attribute-field-does-not-resolve-to-a-valid","errorCode":null,"errorMessage":"The attribute ':field' does not resolve to a valid model. Try specifying the options method for model class :model explicitly.","messagePattern":"The attribute ':field' does not resolve to a valid model\\. Try specifying the options method for model class :model explicitly\\.","errorType":"exception","errorClass":"SystemException","httpStatus":null,"severity":"error","filePath":"modules/backend/classes/FormField.php","lineNumber":567,"sourceCode":"                ]));\n            }\n\n            $fieldOptions = $model->$methodName($this->value, $this->fieldName, $data);\n        }\n\n        return $fieldOptions;\n    }\n\n    /**\n     * getOptionsFromModelAsDefault refers to the model method or any of its behaviors\n     */\n    protected function getOptionsFromModelAsDefault($model, $data)\n    {\n        try {\n            [$model, $attribute] = $this->resolveModelAttributeInternal($model, $this->fieldName, ['objectOnly' => true]);\n        }\n        catch (Exception $ex) {\n            throw new SystemException(Lang::get('backend::lang.field.options_method_invalid_model', [\n                'model' => get_class($model),\n                'field' => $this->fieldName\n            ]));\n        }\n\n        $methodName = 'get'.studly_case($attribute).'Options';\n        if (\n            !$this->objectMethodExists($model, $methodName) &&\n            !$this->objectMethodExists($model, 'getDropdownOptions')\n        ) {\n            throw new SystemException(Lang::get('backend::lang.field.options_method_not_exists', [\n                'model' => get_class($model),\n                'method' => $methodName,\n                'field' => $this->fieldName\n            ]));\n        }\n\n        if ($this->objectMethodExists($model, $methodName)) {","sourceCodeStart":549,"sourceCodeEnd":585,"githubUrl":"https://github.com/octobercms/october/blob/b608633a7e8922487d91a8161499020121c3b3bf/modules/backend/classes/FormField.php#L549-L585","documentation":"Thrown by FormField::getOptionsFromModelAsDefault when the field name cannot be resolved to a related model attribute while trying to auto-derive options. This is the fallback path when no explicit options are configured: resolving the field's model relation/attribute threw, so the error suggests declaring the options method explicitly.","triggerScenarios":"Thrown at modules/backend/classes/FormField.php:567 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Define an explicit options method on the model (e.g. getFieldNameOptions) or set options in the field config","Fix the field name so it resolves to an existing attribute or relation on the model","For relation fields, ensure the relation is properly defined on the model class"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b608633a7e8922487d91a8161499020121c3b3bf","analyzedAt":"2026-08-21T04:24:57.515Z","contentChangedAt":"2026-08-21T04:24:57.515Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}