livewire/livewire · error · Exception

Can't set model properties directly

Error message

Can't set model properties directly

What it means

Error "Can't set model properties directly" thrown in livewire/livewire.

Source

Thrown at src/Features/SupportModels/ModelSynth.php:95

        // If this model was already resolved by route binding (via
        // SubstituteBindings middleware), reuse it to avoid a duplicate query.
        $resolvedModel = app(PersistentMiddleware::class)->getResolvedRouteModel($class, $key);

        if ($resolvedModel) {
            return $resolvedModel;
        }

        return $this->makeLazyProxy($class, $meta, function () use ($class, $key) {
            return (new $class)->newQueryForRestoration($key)->useWritePdo()->firstOrFail();
        });
    }

    function get(&$target, $key) {
        throw new \Exception('Can\'t access model properties directly');
    }

    function set(&$target, $key, $value, $pathThusFar, $fullPath) {
        throw new \Exception('Can\'t set model properties directly');
    }

    function call($target, $method, $params, $addEffect) {
        throw new \Exception('Can\'t call model methods directly');
    }
}

View on GitHub (pinned to 1a3fde34c5)

When it happens

Trigger: Thrown at src/Features/SupportModels/ModelSynth.php:95 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of livewire/livewire@1a3fde34c5 (2026-08-17). Data as JSON: /api/errors/b563956806a70456. Report an issue: GitHub.