laravel/framework · error · InvalidArgumentException
Disk [{$name}] 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. Laravel selects the adapter factory by the 'driver' field; an empty value means the disk is not actually configured, so building it would be meaningless.
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 bd6b5437e6)
Solutions
- Add the disk to config/filesystems.php under filesystems.disks with a 'driver' key.
- Set the missing env var (e.g. FILESYSTEM_DRIVER=local).
- Check the disk name spelling and case.
- Run `php artisan config:cache` after editing config so changes take effect.
Example fix
// before - 'reports' disk referenced but not configured
Storage::disk('reports')->put('x.txt', 'hi');
// after - add to config/filesystems.php
// 'disks' => [
// 'reports' => ['driver' => 'local', 'root' => storage_path('app/reports')],
// ]
Storage::disk('reports')->put('x.txt', 'hi'); Defensive patterns
Strategy: validation
Validate before calling
$config = config("filesystems.disks.{$name}");
if (empty($config) || empty($config['driver'])) {
throw new RuntimeException("Disk [{$name}] is not configured");
}
return Storage::disk($name); Type guard
function diskIsConfigured(string $name): bool
{
$cfg = config("filesystems.disks.{$name}");
return is_array($cfg) && !empty($cfg['driver']);
} Try / catch
try {
return Storage::disk($name);
} catch (\InvalidArgumentException $e) {
if (str_contains($e->getMessage(), 'does not have a configured driver')) {
abort(500, "Storage disk [{$name}] misconfigured");
}
throw $e;
} Prevention
- Define every referenced disk in config/filesystems.php.
- Set all env vars backing disk driver config.
- Validate disk config at boot in service providers.
When it happens
Trigger: Calling Storage::disk($name) where $name has no entry under filesystems.disks in config, or whose entry exists but omits 'driver'. Also triggered when env vars backing the driver are unset and config returns [].
Common situations: Referencing a disk name that doesn't exist; missing FILESYSTEM_DRIVER env var; typo in the disk key; env-based driver (`'driver' => env('FS_DRIVER')`) where the env is unset yielding null.
Related errors
- Driver [{$driver}] is not supported.
- Auth driver [{$config['driver']}] for guard [{$name}] is not
- Driver [{$config['driver']}] is not supported.
- Cache store [{$name}] is not defined.
- Unsupported driver [{$config['driver']}].
AI-assisted analysis of laravel/framework@bd6b5437e6 (2026-08-06).
Data as JSON: /data/errors/d3eb4f3f3ce180c3.json.
Report an issue: GitHub.