octobercms/october · error · ApplicationException

backend::lang.model.not_found

Error message

backend::lang.model.not_found

What it means

makePivotFormWidget, for incrementing pivot keys, loads the pivot record via wherePivot(pivotKey, pivotId)->first(); a null result raises the localized backend::lang.model.not_found error — the referenced pivot row is gone or the pivotId posted is stale.

Solutions

  1. Refresh the pivot list — the pivot record was likely deleted
  2. Verify the posted pivot id belongs to the current parent relation
  3. Check pivot model key configuration (incrementing vs composite keys)
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at modules/backend/behaviors/relationcontroller/HasPivotMode.php:67 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/e4f5a797b8efda0e. Report an issue: GitHub.

Appendix: source

Thrown at modules/backend/behaviors/relationcontroller/HasPivotMode.php:67

            return null;
        }

        $config->model = $this->relationModel;
        $config->arrayName = class_basename($this->relationModel);
        $config->context = $this->evalFormContext('pivot', !!$this->manageId);
        $config->alias = $this->alias . 'ManagePivotForm';

        $foreignKeyName = $this->relationModel->getQualifiedKeyName();

        // Incrementing pivot record
        if ($this->pivotId && ($pivotKey = $this->isPivotIncrementing())) {
            $this->pivotModel = $this->relationObject->wherePivot($pivotKey, $this->pivotId)->first();

            if ($this->pivotModel) {
                $config->model = $this->pivotModel;
            }
            else {
                throw new ApplicationException(Lang::get('backend::lang.model.not_found', [
                    'class' => get_class($this->relationObject->newPivot()),
                    'id' => $this->pivotId,
                ]));
            }
        }
        // Existing record
        elseif ($this->manageId) {
            $this->pivotModel = $this->relationObject->where($foreignKeyName, $this->manageId)->first();

            if ($this->pivotModel) {
                $config->model = $this->pivotModel;
            }
            else {
                throw new ApplicationException(Lang::get('backend::lang.model.not_found', [
                    'class' => get_class($config->model),
                    'id' => $this->manageId,
                ]));
            }

View on GitHub (pinned to b608633a7e)