laravel/framework · error · InvalidArgumentException

Disk [ ] does not have a configured driver.

Error message

Disk [{$name}] does not have a configured driver.

What it means

Thrown by FilesystemManager::resolve() when the resolved disk config array has no 'driver' key. The driver name is required to dispatch to create{Driver}Driver() or a custom creator; an empty/missing driver means the disk definition is incomplete.

Solutions

  1. Add a 'driver' key to the disk config in config/filesystems.php.
  2. Ensure any env() used for the driver has a fallback: env('FS_DRIVER', 'local').
  3. Run php artisan config:clear then config:cache after editing.
  4. Check the disk name spelling matches between Storage::disk($name) and the config key.

Example fix

// before — config/filesystems.php
'media' => [
    'root' => storage_path('app/media'),
],

// after
'media' => [
    'driver' => 'local',
    'root' => storage_path('app/media'),
],
Defensive patterns

Strategy: validation

Validate before calling

if (empty(config("filesystems.disks.{$name}.driver"))) {
    throw new InvalidArgumentException("Disk [{$name}] missing 'driver' config.");
}
Storage::disk($name);

Type guard

function diskHasDriver(string $name): bool {
    return ! empty(config("filesystems.disks.{$name}.driver"));
}

Try / catch

try {
    Storage::disk($name);
} catch (\InvalidArgumentException $e) {
    report($e);
    // fall back to default disk
    Storage::disk();
}

Prevention

When it happens

Trigger: Storage::disk($name) (or any Storage facade call resolving that disk) where config/filesystems.php 'disks' entry for $name lacks 'driver', or the entry resolved to an empty array.

Common situations: Missing disk entry in config/filesystems.php; env var used for the driver name is unset (e.g., 'driver' => env('FS_DRIVER')); typo in disk key; config cache stale after editing.

Related errors


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

Appendix: source

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

    {
        return $this->disks[$name] ?? $this->resolve($name);
    }

    /**
     * Resolve the given disk.
     *
     * @param  string  $name
     * @param  array|null  $config
     * @return \Illuminate\Contracts\Filesystem\Filesystem
     *
     * @throws \InvalidArgumentException
     */
    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);
    }

    /**

View on GitHub (pinned to e0f6eb3518)