{"record":{"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/e0f6eb3518ac29fbbca8529e97d0df7fc9f24481/src/Illuminate/Filesystem/FilesystemManager.php#L283-L319","documentation":"Thrown by FilesystemManager::createScopedDriver() when the scoped disk config has no 'disk' key. A scoped driver wraps another disk to apply a path prefix; without knowing which parent disk to scope, it cannot be built.","triggerScenarios":"Defining a disk with 'driver' => 'scoped' in config/filesystems.php but omitting the 'disk' option that names the underlying disk (or passing such config to Storage::build()).","commonSituations":"Misreading the scoped driver docs; renaming the parent disk key without updating scoped configs; copy-paste config missing the disk line; expecting the scope to default to the default disk.","solutions":["Add 'disk' => 's3' (or another configured disk name / inline array) to the scoped disk config.","Ensure the referenced parent disk itself resolves without error.","Re-run php artisan config:clear after editing.","Document each scoped disk with both 'disk' and 'prefix'."],"exampleFix":"// before\n'thumbnails' => [\n    'driver' => 'scoped',\n    'prefix' => 'thumbnails',\n],\n\n// after\n'thumbnails' => [\n    'driver' => 'scoped',\n    'disk' => 's3',\n    'prefix' => 'thumbnails',\n],","handlingStrategy":"validation","validationCode":"if (empty(config(\"filesystems.disks.{$name}.disk\"))) {\n    throw new InvalidArgumentException(\"Scoped disk [{$name}] missing 'disk' option.\");\n}","typeGuard":"function scopedDiskHasParent(string $name): bool {\n    return ! empty(config(\"filesystems.disks.{$name}.disk\"));\n}","tryCatchPattern":"try {\n    Storage::disk($name);\n} catch (\\InvalidArgumentException $e) {\n    report($e);\n}","preventionTips":["Always set 'disk' for scoped disks.","Reference an existing, valid parent disk.","Document scoped disk requirements.","Run config:clear after edits."],"tags":["filesystem","scoped","config","driver"],"backgroundTag":null,"analyzedSha":"e0f6eb3518ac29fbbca8529e97d0df7fc9f24481","analyzedAt":"2026-08-11T20:52:37.562Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}