{"record":{"id":"8c2b8bd9ce3c151a","repo":"mongodb/mongoid","slug":"empty-configuration-file-path","errorCode":null,"errorMessage":"Empty configuration file: %{path}.","messagePattern":"Empty configuration file: %(.+?)\\.","errorType":"exception","errorClass":"Mongoid::Errors::EmptyConfigFile","httpStatus":null,"severity":"error","filePath":"lib/mongoid/config/environment.rb","lineNumber":49,"sourceCode":"\n      # Load the yaml from the provided path and return the settings for the\n      # specified environment, or for the current Mongoid environment.\n      #\n      # @example Load the yaml.\n      #   Environment.load_yaml(\"/work/mongoid.yml\")\n      #\n      # @param [ String ] path The location of the file.\n      # @param [ String | Symbol ] environment Optional environment name to\n      #   override the current Mongoid environment.\n      #\n      # @return [ Hash ] The settings.\n      #\n      # @api private\n      def load_yaml(path, environment = nil)\n        env = environment ? environment.to_s : env_name\n\n        contents = File.read(path)\n        raise Mongoid::Errors::EmptyConfigFile.new(path) if contents.empty?\n\n        # These are the classes that can be used in a Mongoid\n        # configuration file in addition to standard YAML types.\n        permitted_classes = [\n          # Symbols occur as values for read preference, for example.\n          Symbol,\n          # BSON::Binary occur as keyId values for FLE (more precisely,\n          # the keyIds are UUIDs).\n          BSON::Binary\n        ]\n\n        result = ERB.new(contents).result\n        data = YAML.safe_load(result, permitted_classes: permitted_classes, aliases: true)\n\n        raise Mongoid::Errors::InvalidConfigFile.new(path) unless data.is_a?(Hash)\n\n        data[env]\n      end","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/mongodb/mongoid/blob/0da0e23d71adfbad31128c18e5e2c8c301c6f7c4/lib/mongoid/config/environment.rb#L31-L67","documentation":"Error \"Empty configuration file: %{path}.\" thrown in mongodb/mongoid.","triggerScenarios":"Thrown at lib/mongoid/config/environment.rb:49 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"}