{"record":{"id":"d3c3d6f041d9acd2","repo":"laravel/framework","slug":"scoped-disk-is-missing-prefix-configuration-opti","errorCode":null,"errorMessage":"Scoped disk is missing \"prefix\" configuration option.","messagePattern":"Scoped disk is missing \"prefix\" configuration option\\.","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Filesystem/FilesystemManager.php","lineNumber":303,"sourceCode":"        }\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\n                if (isset($config['visibility'])) {\n                    $parent['visibility'] = $config['visibility'];","sourceCodeStart":285,"sourceCodeEnd":321,"githubUrl":"https://github.com/laravel/framework/blob/e0f6eb3518ac29fbbca8529e97d0df7fc9f24481/src/Illuminate/Filesystem/FilesystemManager.php#L285-L321","documentation":"Thrown by FilesystemManager::createScopedDriver() when 'disk' is present but 'prefix' is empty. The prefix is the path namespace the scoped driver applies on top of the parent disk; an empty prefix would make the scope a no-op, so Laravel requires it explicitly.","triggerScenarios":"Defining a scoped disk with 'driver' => 'scoped' and 'disk' set, but omitting 'prefix' or leaving it as an empty string.","commonSituations":"Copy-paste config missing the prefix line; intent was to alias the parent disk without a namespace (not supported — use the parent directly); typo in 'prefix' key (e.g., 'path').","solutions":["Add a non-empty 'prefix' to the scoped disk config.","If no namespace is needed, drop the scoped disk and use the parent disk directly.","Use a meaningful prefix (e.g., 'thumbnails', 'backups') that matches your storage layout.","Run php artisan config:clear / config:cache after editing."],"exampleFix":"// before\n'thumbnails' => [\n    'driver' => 'scoped',\n    'disk' => 's3',\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}.prefix\"))) {\n    throw new InvalidArgumentException(\"Scoped disk [{$name}] missing 'prefix' option.\");\n}","typeGuard":"function scopedDiskHasPrefix(string $name): bool {\n    return ! empty(config(\"filesystems.disks.{$name}.prefix\"));\n}","tryCatchPattern":"try {\n    Storage::disk($name);\n} catch (\\InvalidArgumentException $e) {\n    report($e);\n}","preventionTips":["Always set a non-empty 'prefix' for scoped disks.","Drop the scoped disk if no namespace is needed.","Use meaningful prefixes matching storage layout.","Run config:clear after edits."],"tags":["filesystem","scoped","config","prefix"],"backgroundTag":null,"analyzedSha":"e0f6eb3518ac29fbbca8529e97d0df7fc9f24481","analyzedAt":"2026-08-11T20:52:37.562Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}