octobercms/october · error · ApplicationException

Model ':class' does not contain a definition for ':relation'

Error message

Model ':class' does not contain a definition for ':relation'.

What it means

Error "Model ':class' does not contain a definition for ':relation'." thrown in octobercms/october.

Source

Thrown at modules/backend/traits/FormModelWidget.php:30

 * @package october\backend
 * @author Alexey Bobkov, Samuel Georges
 */
trait FormModelWidget
{
    /**
     * Returns the final model and attribute name of
     * a nested HTML array attribute.
     * Eg: [$model, $attribute] = $this->resolveModelAttribute($this->valueFrom);
     * @param  string $attribute.
     * @return array
     */
    public function resolveModelAttribute($attribute)
    {
        try {
            return $this->formField->resolveModelAttribute($this->model, $attribute);
        }
        catch (Exception $ex) {
            throw new ApplicationException(Lang::get('backend::lang.model.missing_relation', [
                'class' => get_class($this->model),
                'relation' => $attribute
            ]));
        }
    }

    /**
     * nearestModelAttribute
     */
    public function nearestModelAttribute($attribute)
    {
        return $this->formField->nearestModelAttribute($this->model, $attribute);
    }

    /**
     * Returns the model of a relation type,
     * supports nesting via HTML array.
     * @return Relation

View on GitHub (pinned to b608633a7e)

When it happens

Trigger: Thrown at modules/backend/traits/FormModelWidget.php:30 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of octobercms/october@b608633a7e (2026-08-21). Data as JSON: /api/errors/13c1d6d72113951f. Report an issue: GitHub.