laravel/framework · error · InvalidArgumentException

Driver [ ] is not supported.

Error message

Driver [{$driver}] is not supported.

What it means

Thrown by FilesystemManager::resolve() when the 'driver' key is present but no create{Driver}Driver() method exists on the manager and no custom creator was registered via extend(). This covers typos and missing/unsupported driver packages.

Solutions

  1. Correct the driver name in config/filesystems.php (e.g., 's3', 'local', 'ftp', 'sftp', 'scoped').
  2. composer require the provider package for third-party drivers (e.g., league/flysystem-aws-s3-v3).
  3. For custom drivers, register via Storage::extend('mydriver', fn (...) => ...).
  4. Run php artisan config:clear / config:cache after changes.

Example fix

// before
'media' => ['driver' => 'aws', ...],

// after
'media' => ['driver' => 's3', ...],
// plus: composer require league/flysystem-aws-s3-v3 (^3.0)
Defensive patterns

Strategy: validation

Validate before calling

$driver = config("filesystems.disks.{$name}.driver");
if (! method_exists(Storage::getFacadeRoot()->getFileManager(), 'create'.ucfirst($driver).'Driver')
    && ! array_key_exists($driver, \Illuminate\Filesystem\FilesystemManager::class)) {
    throw new InvalidArgumentException("Driver [{$driver}] is not supported.");
}

Type guard

function isSupportedDriver(string $driver): bool {
    return in_array($driver, ['local','public','s3','ftp','sftp','scoped','r2','gcs'], true);
}

Try / catch

try {
    Storage::disk($name);
} catch (\InvalidArgumentException $e) {
    report($e);
    Storage::extend($driver, fn () => new CustomAdapter(...));
    Storage::disk($name);
}

Prevention

When it happens

Trigger: Storage::disk($name) where config['driver'] is e.g. 's4', 'aws', or 'google' instead of 's3'/'gcs'; or a driver whose package (league/flysystem-*) is not installed and no extend() registration covers it.

Common situations: Driver name typo in config/filesystems.php; third-party driver package not composer-required; driver name case mismatch (the manager uses ucfirst() so 's3' becomes createS3Driver, but a fully custom name needs an exact method or extend() call); config cache stale.

Related errors


AI-assisted analysis of laravel/framework@e0f6eb3518 (2026-08-11). Data as JSON: /api/errors/58542fda48d5be93. Report an issue: GitHub.

Appendix: source

Thrown at src/Illuminate/Filesystem/FilesystemManager.php:155

     */
    protected function resolve($name, $config = null)
    {
        $config ??= $this->getConfig($name);

        if (empty($config['driver'])) {
            throw new InvalidArgumentException("Disk [{$name}] does not have a configured driver.");
        }

        $driver = $config['driver'];

        if (isset($this->customCreators[$driver])) {
            return $this->callCustomCreator($config);
        }

        $driverMethod = 'create'.ucfirst($driver).'Driver';

        if (! method_exists($this, $driverMethod)) {
            throw new InvalidArgumentException("Driver [{$driver}] is not supported.");
        }

        return $this->{$driverMethod}($config, $name);
    }

    /**
     * Call a custom driver creator.
     *
     * @param  array  $config
     * @return \Illuminate\Contracts\Filesystem\Filesystem
     */
    protected function callCustomCreator(array $config)
    {
        return $this->customCreators[$config['driver']]($this->app, $config);
    }

    /**
     * Create an instance of the local driver.

View on GitHub (pinned to e0f6eb3518)