{"record":{"id":"86935f637749c170","repo":"mongodb/laravel-mongodb","slug":"gridfs-adapter-for-flysystem-is-missing-try-running-composer","errorCode":null,"errorMessage":"GridFS adapter for Flysystem is missing. Try running \"composer require league/flysystem-gridfs\"","messagePattern":"GridFS adapter for Flysystem is missing\\. Try running \"composer require league/flysystem-gridfs\"","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/MongoDBServiceProvider.php","lineNumber":121,"sourceCode":"        // Add connector for queue support.\n        $this->app->resolving('queue', function ($queue) {\n            $queue->addConnector('mongodb', function () {\n                return new MongoConnector($this->app['db']);\n            });\n        });\n\n        $this->registerFlysystemAdapter();\n        $this->registerScoutEngine();\n        $this->registerBoostTools();\n    }\n\n    private function registerFlysystemAdapter(): void\n    {\n        // GridFS adapter for filesystem\n        $this->app->resolving('filesystem', static function (FilesystemManager $filesystemManager) {\n            $filesystemManager->extend('gridfs', function (Application $app, array $config) {\n                if (! class_exists(GridFSAdapter::class)) {\n                    throw new RuntimeException('GridFS adapter for Flysystem is missing. Try running \"composer require league/flysystem-gridfs\"');\n                }\n\n                $bucket = $config['bucket'] ?? null;\n\n                if ($bucket instanceof Closure) {\n                    // Get the bucket from a factory function\n                    $bucket = $bucket($app, $config);\n                } elseif (is_string($bucket) && $app->has($bucket)) {\n                    // Get the bucket from a service\n                    $bucket = $app->get($bucket);\n                } elseif (is_string($bucket) || $bucket === null) {\n                    // Get the bucket from the database connection\n                    $connection = $app['db']->connection($config['connection']);\n                    if (! $connection instanceof Connection) {\n                        throw new InvalidArgumentException(sprintf('The database connection \"%s\" does not use the \"mongodb\" driver.', $config['connection'] ?? $app['config']['database.default']));\n                    }\n\n                    $bucket = $connection->getClient()","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/mongodb/laravel-mongodb/blob/0634653039468ceb0268a69192bdac64469ed043/src/MongoDBServiceProvider.php#L103-L139","documentation":"Thrown in the 'gridfs' filesystem extension registration when class_exists(GridFSAdapter::class) fails, meaning the league/flysystem-gridfs package is not installed. The adapter class is only autoloaded if the Composer package is present, so any attempt to configure a gridfs disk before installing it fails at resolution time with a RuntimeException pointing at the missing Composer requirement.","triggerScenarios":"Thrown at src/MongoDBServiceProvider.php:121 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run composer require league/flysystem-gridfs to install the missing adapter.","Verify the package is in the composer.json of the deployed environment (it may be absent in production).","Use a non-GridFS filesystem disk until the adapter dependency is installed."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0634653039468ceb0268a69192bdac64469ed043","analyzedAt":"2026-09-15T02:56:37.067Z","contentChangedAt":"2026-09-15T02:56:37.067Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}