laravel/framework · error · RuntimeException
This driver does not support retrieving URLs.
Error message
This driver does not support retrieving URLs.
What it means
Thrown by FilesystemAdapter::url() when none of the URL-resolution branches succeed: the underlying adapter has no getUrl() method, the driver has no getUrl(), and the adapter is neither FtpAdapter/SftpAdapter nor LocalAdapter. The configured disk simply cannot synthesize a public URL for a stored object.
Solutions
- For S3/public clouds, set the 'url' (and 'bucket_endpoint'/'endpoint') in the disk config so the adapter builds URLs.
- Implement getUrl() on a custom adapter, or register a URL via Storage::disk()->build() with a URL-aware adapter.
- For local disks ensure the driver resolves to LocalAdapter and 'url' is configured.
- Use temporaryUrl() if you need time-limited access instead of a permanent URL.
Example fix
// before
Storage::disk('s3')->url($path); // throws
// after: config/filesystems.php
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
] Defensive patterns
Strategy: validation
Validate before calling
if (empty(config("filesystems.disks.{$name}.url")) && ! in_array(config("filesystems.disks.{$name}.driver"), ['local','ftp','sftp'], true)) {
throw new RuntimeException("Disk [{$name}] cannot resolve URLs; set 'url' in config.");
}
Storage::disk($name)->url($path); Type guard
function diskSupportsUrl(string $name): bool {
$driver = config("filesystems.disks.{$name}.driver");
return method_exists(Storage::disk($name)->getAdapter(), 'getUrl')
|| in_array($driver, ['local','ftp','sftp'], true);
} Try / catch
try {
$url = Storage::disk($name)->url($path);
} catch (\RuntimeException $e) {
report($e);
$url = null;
} Prevention
- Set 'url' on cloud disks in filesystems.php.
- Use local or S3 adapters when URLs are required.
- Implement getUrl() on custom adapters.
- Prefer temporaryUrl() for protected assets.
When it happens
Trigger: Calling Storage::disk($name)->url($path) on a disk whose driver does not advertise URLs — e.g., an Amazon S3 v2 adapter without a 'url'/'endpoint' config, an in-memory adapter, a custom driver that does not implement getUrl().
Common situations: Missing 'url' key in config/filesystems.php for an S3 disk; using a local-style disk on a custom adapter without implementing getUrl; switch from league/flysystem-aws-webda… adapters; calling url() on a disk that should have used temporaryUrl() instead.
Related errors
- This driver does not support creating temporary upload URLs.
- This driver does not support creating temporary URLs.
- Disk [ ] does not have a configured driver.
- Driver [ ] is not supported.
- Scoped disk is missing "disk" configuration option.
AI-assisted analysis of laravel/framework@e0f6eb3518 (2026-08-11).
Data as JSON: /api/errors/cf2dacfd64dd7edb.
Report an issue: GitHub.
Appendix: source
Thrown at src/Illuminate/Filesystem/FilesystemAdapter.php:797
*/
public function url($path)
{
if (isset($this->config['prefix'])) {
$path = $this->concatPathToUrl($this->config['prefix'], $path);
}
$adapter = $this->adapter;
if (method_exists($adapter, 'getUrl')) {
return $adapter->getUrl($path);
} elseif (method_exists($this->driver, 'getUrl')) {
return $this->driver->getUrl($path);
} elseif ($adapter instanceof FtpAdapter || $adapter instanceof SftpAdapter) {
return $this->getFtpUrl($path);
} elseif ($adapter instanceof LocalAdapter) {
return $this->getLocalUrl($path);
} else {
throw new RuntimeException('This driver does not support retrieving URLs.');
}
}
/**
* Get the URL for the file at the given path.
*
* @param string $path
* @return string
*/
protected function getFtpUrl($path)
{
return isset($this->config['url'])
? $this->concatPathToUrl($this->config['url'], $path)
: $path;
}
/**
* Get the URL for the file at the given path.View on GitHub (pinned to e0f6eb3518)