{"record":{"id":"65262a76828b839f","repo":"mongodb/mongoid","slug":"cannot-find-any-model-with-type-model-alias","errorCode":null,"errorMessage":"Cannot find any model with type %{model_alias}","messagePattern":"Cannot find any model with type %(.+?)","errorType":"exception","errorClass":"Mongoid::Errors::UnrecognizedModelAlias","httpStatus":null,"severity":"error","filePath":"lib/mongoid/model_resolver.rb","lineNumber":150,"sourceCode":"                     else\n                       Mongoid::ModelResolver.resolvers.keys.detect { |k| Mongoid::ModelResolver.resolvers[k] == self }\n                     end\n          resolver ||= self # if it hasn't been registered, we'll show it the best we can\n          raise Mongoid::Errors::UnregisteredClass.new(klass, resolver)\n        end\n      end\n\n      # Returns the document class that has been registered by the given key.\n      #\n      # @param [ String ] key the key by which to query the corresponding class.\n      #\n      # @raise Mongoid::Errors::UnrecognizedModelAlias if the given key has not\n      #   been registered with this resolver.\n      #\n      # @return [ Class ] the document class that has been registered with the given key.\n      def model_for(key)\n        @key_to_model.fetch(key) do\n          raise Mongoid::Errors::UnrecognizedModelAlias, key\n        end\n      end\n    end\n  end\nend\n","sourceCodeStart":132,"sourceCodeEnd":156,"githubUrl":"https://github.com/mongodb/mongoid/blob/0da0e23d71adfbad31128c18e5e2c8c301c6f7c4/lib/mongoid/model_resolver.rb#L132-L156","documentation":"Error \"Cannot find any model with type %{model_alias}\" thrown in mongodb/mongoid.","triggerScenarios":"Thrown at lib/mongoid/model_resolver.rb:150 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0da0e23d71adfbad31128c18e5e2c8c301c6f7c4","analyzedAt":"2026-08-23T06:25:47.656Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}