filamentphp/filament · error · LogicException

No [{$userClass}] model found. Please bind an authenticatabl

Error message

No [{$userClass}] model found. Please bind an authenticatable model to the [Illuminate\Contracts\Auth\Authenticatable] interface in a service provider's [register()] method.

What it means

Filament's Import model mirrors Export: it records who ran each import through a `user()` relationship. It resolves `Illuminate\Contracts\Auth\Authenticatable` from the container first, then falls back to the conventional `App\Models\User` class. If neither the binding nor the conventional class exists, this LogicException is thrown when the relationship is first resolved (e.g. after an `ImportAction` completes).

Source

Thrown at packages/actions/src/Imports/Models/Import.php:79

    public function user(): BelongsTo
    {
        if (static::hasPolymorphicUserRelationship()) {
            return $this->morphTo();
        }

        /** @var ?Authenticatable $authenticatable */
        $authenticatable = app(Authenticatable::class);

        if ($authenticatable) {
            /** @phpstan-ignore-next-line */
            return $this->belongsTo($authenticatable::class);
        }

        $userClass = app()->getNamespace() . 'Models\\User';

        if (! class_exists($userClass)) {
            throw new LogicException('No [' . $userClass . '] model found. Please bind an authenticatable model to the [Illuminate\\Contracts\\Auth\\Authenticatable] interface in a service provider\'s [register()] method.');
        }

        /** @phpstan-ignore-next-line */
        return $this->belongsTo($userClass);
    }

    /**
     * @param  array<string, string>  $columnMap
     * @param  array<string, mixed>  $options
     */
    public function getImporter(
        array $columnMap,
        array $options,
    ): Importer {
        $this->columnMap($columnMap);
        $this->options($options);

        return app($this->importer, [

View on GitHub (pinned to 53483fa934)

Solutions

  1. Bind the contract in `app/Providers/AppServiceProvider.php`: `$this->app->bind(\Illuminate\Contracts\Auth\Authenticatable::class, config('auth.providers.users.model'));`
  2. Verify `App\Models\User` exists and is autoloaded if that is genuinely your model.
  3. Add the binding once in shared infrastructure instead of patching per-panel.

Example fix

// before — import fails resolving the `user()` relation
ImportAction::make();

// after — app/Providers/AppServiceProvider.php
use Illuminate\Contracts\Auth\Authenticatable;

public function register(): void
{
    $this->app->bind(Authenticatable::class, config('auth.providers.users.model'));
}
Defensive patterns

Strategy: validation

Validate before calling

// Run before enabling import actions
use Illuminate\Contracts\Auth\Authenticatable;

$userModelResolved = app()->bound(Authenticatable::class)
    || class_exists(app()->getNamespace() . 'Models\\User');

if (! $userModelResolved) {
    throw new RuntimeException(
        'Bind Authenticatable to your user model before using imports.'
    );
}

Try / catch

try {
    return $import->user;
} catch (LogicException $exception) {
    log()->warning('Import user relation unavailable: ' . $exception->getMessage());

    return null;
}

Prevention

When it happens

Trigger: Running an import in an app whose user model lives outside `App\Models\User` (custom namespace, separate admin model, multi-guard) with no `Authenticatable` binding registered in a service provider.

Common situations: Domain-structured apps (`App\Domains\...`), packages providing their own user models, or apps upgraded from older setups where the user class moved.

Understand the failure class

Related errors


AI-assisted analysis of filamentphp/filament@53483fa934 (2026-08-17). Data as JSON: /api/errors/e5dbdc3ded7bca6e. Report an issue: GitHub.