{"id":"e033f7602f97f038","repo":"laravel/framework","slug":"scoped-disk-is-missing-disk-configuration-option","errorCode":null,"errorMessage":"Scoped disk is missing \"disk\" configuration option.","messagePattern":"Scoped disk is missing \"disk\" configuration option\\.","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Filesystem/FilesystemManager.php","lineNumber":301,"sourceCode":"                $config['credentials']['token'] = $config['token'];\n            }\n        }\n\n        return Arr::except($config, ['token']);\n    }\n\n    /**\n     * Create a scoped driver.\n     *\n     * @param  array  $config\n     * @return \\Illuminate\\Contracts\\Filesystem\\Filesystem\n     *\n     * @throws \\InvalidArgumentException\n     */\n    public function createScopedDriver(array $config)\n    {\n        if (empty($config['disk'])) {\n            throw new InvalidArgumentException('Scoped disk is missing \"disk\" configuration option.');\n        } elseif (empty($config['prefix'])) {\n            throw new InvalidArgumentException('Scoped disk is missing \"prefix\" configuration option.');\n        }\n\n        return $this->build(tap(\n            is_string($config['disk']) ? $this->getConfig($config['disk']) : $config['disk'],\n            function (&$parent) use ($config) {\n                if (empty($parent['prefix'])) {\n                    $parent['prefix'] = $config['prefix'];\n                } else {\n                    $separator = $parent['directory_separator'] ?? DIRECTORY_SEPARATOR;\n\n                    $parentPrefix = rtrim($parent['prefix'], $separator);\n                    $scopedPrefix = ltrim($config['prefix'], $separator);\n\n                    $parent['prefix'] = \"{$parentPrefix}{$separator}{$scopedPrefix}\";\n                }\n","sourceCodeStart":283,"sourceCodeEnd":319,"githubUrl":"https://github.com/laravel/framework/blob/bd6b5437e6ad87bb49f9b426724f07a9f64e9683/src/Illuminate/Filesystem/FilesystemManager.php#L283-L319","documentation":"Thrown by FilesystemManager::createScopedDriver() when a disk configured with 'driver' => 'scoped' omits the 'disk' key. A scoped disk layers a path prefix onto an existing parent disk, so the parent disk name must be specified; without it there is nothing to scope.","triggerScenarios":"Defining a scoped disk in config/filesystems.php with 'driver' => 'scoped' but no 'disk' key, then calling Storage::disk() on it.","commonSituations":"Setting up multi-tenant path prefixes; copying a scoped disk example but forgetting the parent disk reference; typoing 'disk' as 'parent' or 'base'.","solutions":["Add 'disk' => 's3' (or whichever parent) to the scoped disk config.","Ensure the referenced parent disk is itself defined under filesystems.disks.","Use the correct keys: scoped disks need both 'disk' and 'prefix'."],"exampleFix":"// before\n// 'disks' => ['tenants' => ['driver' => 'scoped', 'prefix' => 'tenant-a']]\n\n// after\n// 'disks' => [\n//     'tenants' => ['driver' => 'scoped', 'disk' => 's3', 'prefix' => 'tenant-a'],\n// ]","handlingStrategy":"validation","validationCode":"$cfg = config(\"filesystems.disks.{$name}\");\nif (($cfg['driver'] ?? null) === 'scoped' && empty($cfg['disk'])) {\n    throw new RuntimeException('Scoped disk requires a \"disk\" option');\n}","typeGuard":"function scopedDiskHasParent(array $config): bool\n{\n    return ($config['driver'] ?? '') === 'scoped' && !empty($config['disk']);\n}","tryCatchPattern":"try {\n    return Storage::disk($name);\n} catch (\\InvalidArgumentException $e) {\n    if (str_contains($e->getMessage(), 'missing \"disk\"')) {\n        abort(500, 'Scoped disk misconfigured: missing parent disk');\n    }\n    throw $e;\n}","preventionTips":["Always set 'disk' on scoped disks.","Validate scoped disk config at deploy time.","Reference an existing parent disk name."],"tags":["filesystem","configuration","scoped-disk","multi-tenant"],"analyzedSha":"bd6b5437e6ad87bb49f9b426724f07a9f64e9683","analyzedAt":"2026-08-06T00:28:32.783Z","schemaVersion":2}