livewire/livewire · error · CannotCallComputedDirectlyException

Cannot call [{$methodName}()] computed property method direc

Error message

Cannot call [{$methodName}()] computed property method directly on component: {$componentName}

What it means

Error "Cannot call [{$methodName}()] computed property method directly on component: {$componentName}" thrown in livewire/livewire.

Source

Thrown at src/Features/SupportComputed/BaseComputed.php:25

use Livewire\Features\SupportAttributes\Attribute;
use Illuminate\Support\Facades\Cache;

#[\Attribute]
class BaseComputed extends Attribute
{
    protected $requestCachedValue;

    function __construct(
        public $persist = false,
        public $seconds = 3600, // 1 hour...
        public $cache = false,
        public $key = null,
        public $tags = null,
    ) {}

    function call()
    {
        throw new CannotCallComputedDirectlyException(
            $this->component->getName(),
            $this->getName(),
        );
    }

    public function handleMagicGet($returnValue)
    {
        if ($this->persist) {
            $returnValue(
                $this->requestCachedValue ??= $this->handlePersistedGet()
            );

            return;
        }

        if ($this->cache) {
            $returnValue(
                $this->requestCachedValue ??= $this->handleCachedGet()

View on GitHub (pinned to 1a3fde34c5)

When it happens

Trigger: Thrown at src/Features/SupportComputed/BaseComputed.php:25 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/a97813d1ec8c99ed. Report an issue: GitHub.