{"record":{"id":"28a5fb12fda58e99","repo":"carrierwaveuploader/carrierwave","slug":"unknown-storage-storage","errorCode":null,"errorMessage":"Unknown storage: #{storage}","messagePattern":"Unknown storage: #(.+?)","errorType":"exception","errorClass":"CarrierWave::UnknownStorageError","httpStatus":null,"severity":"error","filePath":"lib/carrierwave/uploader/configuration.rb","lineNumber":88,"sourceCode":"        # [storage (Symbol, Class)] The storage engine to use for this uploader\n        #\n        # === Returns\n        #\n        # [Class] the storage engine to be used with this uploader\n        #\n        # === Examples\n        #\n        #     storage :file\n        #     storage CarrierWave::Storage::File\n        #     storage MyCustomStorageEngine\n        #\n        def storage(storage = nil)\n          case storage\n          when Symbol\n            if (storage_engine = storage_engines[storage])\n              self._storage = eval storage_engine\n            else\n              raise CarrierWave::UnknownStorageError, \"Unknown storage: #{storage}\"\n            end\n          when nil\n            # noop\n          else\n            self._storage = storage\n          end\n          _storage\n        end\n        alias_method :storage=, :storage\n\n        ##\n        # Sets the cache storage engine to be used when storing cache files with this uploader.\n        # Same as .storage except for required methods being #cache!(CarrierWave::SanitizedFile),\n        # #retrieve_from_cache! and #delete_dir!.\n        #\n        # === Parameters\n        #\n        # [storage (Symbol, Class)] The cache storage engine to use for this uploader","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/carrierwaveuploader/carrierwave/blob/b5f0abe10ecf6500309fc83e0e8969cf57ba690e/lib/carrierwave/uploader/configuration.rb#L70-L106","documentation":"Raised as CarrierWave::UnknownStorageError by CarrierWave::Uploader.configuration#storage when a Symbol is passed that has no entry in storage_engines. By default only :file (CarrierWave::Storage::File) and :fog (CarrierWave::Storage::Fog) are registered; any other symbol — including engines provided by external gems until registered — is rejected at configure time.","triggerScenarios":"Writing storage :aws, storage :s3, storage :gcs, storage :qiniu etc. in an uploader or initializer without registering that engine key in CarrierWave::Uploader::Base.storage_engines, or without the gem that registers it being loaded.","commonSituations":"Copy-pasted uploader examples targeting carrierwave-aws/carrierwave-google-storage style gems while still on plain carrierwave; typos (:File vs :file); gems whose engine registration code was removed in an upgrade; Spring/Zeitwerk loading order hiding the registration.","solutions":["Use a registered symbol: storage :file or storage :fog (fog covers S3/GCS/Rackspace via fog_credentials)","Register the custom key first: CarrierWave::Uploader::Base.storage_engines[:my_store] = 'MyStore' (or add it via configure) then storage :my_store","Or pass the class directly: storage CarrierWave::Storage::Fog / storage MyStorageEngine","If a third-party storage gem is intended, ensure it is in the Gemfile, required, and its registration runs before the uploader class loads"],"exampleFix":"# before\nclass ImageUploader < CarrierWave::Uploader::Base\n  storage :s3 # UnknownStorageError: only :file/:fog registered\nend\n\n# after\nCarrierWave::Uploader::Base.storage_engines[:s3] = 'CarrierWave::Storage::Fog'\nclass ImageUploader < CarrierWave::Uploader::Base\n  storage :s3 # now resolves to CarrierWave::Storage::Fog\nend","handlingStrategy":"validation","validationCode":"def registered_storage?(sym)\n  CarrierWave::Uploader::Base.storage_engines.key?(sym.to_sym)\nend\n\nraise ArgumentError, \"unknown storage #{storage}\" unless registered_storage?(storage)","typeGuard":"def storage_symbol?(value)\n  value.is_a?(Symbol) && CarrierWave::Uploader::Base.storage_engines.key?(value)\nend","tryCatchPattern":null,"preventionTips":["Register custom engines in an initializer: CarrierWave::Uploader::Base.storage_engines[:my_store] = 'MyStore' before uploaders load","Prefer passing the storage class itself (storage MyStorage) over symbols for anything beyond :file/:fog","Boot-time smoke test: call storage on each configured uploader inside a spec so misconfiguration fails in CI, not production"],"tags":["carrierwave","storage","configuration","unknown-storage"],"backgroundTag":"unknown-storage-backend","analyzedSha":"b5f0abe10ecf6500309fc83e0e8969cf57ba690e","analyzedAt":"2026-08-21T18:07:27.715Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}