{"record":{"id":"9ce95d852cbe18c2","repo":"iberianpig/fusuma","slug":"detect-duplicate-keys-duplicates","errorCode":null,"errorMessage":"Detect duplicate keys #{duplicates}","messagePattern":"Detect duplicate keys #(.+?)","errorType":"exception","errorClass":"InvalidFileError","httpStatus":null,"severity":"error","filePath":"lib/fusuma/config.rb","lineNumber":108,"sourceCode":"      Config::Searcher.find_context(request_context, fallbacks) do\n        ret = Config.search(base)\n        if ret&.key?(key)\n          return ret\n        end\n      end\n      {}\n    end\n\n    # @return [Hash] If check passes\n    # @raise [InvalidFileError] If check does not pass\n    #: (String) -> Array[Hash[Symbol, untyped]]\n    def validate(path)\n      duplicates = []\n      YAMLDuplicationChecker.check(File.read(path), path) do |ignored, duplicate| # steep:ignore UnexpectedBlockGiven\n        MultiLogger.error \"#{path}: #{ignored.value} is duplicated\"\n        duplicates << duplicate.value\n      end\n      raise InvalidFileError, \"Detect duplicate keys #{duplicates}\" unless duplicates.empty?\n\n      yamls = YAML.load_stream(File.read(path)).compact # steep:ignore NoMethod\n      yamls.map do |yaml|\n        raise InvalidFileError, \"Invalid config.yml: #{path}\" unless yaml.is_a? Hash\n\n        yaml.deep_symbolize_keys\n      end\n    rescue Psych::SyntaxError => e\n      raise InvalidFileError, \"Invalid syntax: #{path} #{e.message}\"\n    end\n\n    # @param index [Index]\n    #: (Fusuma::Config::Index) -> (String | Hash[untyped, untyped] | Integer | Float)?\n    def search(index)\n      return nil if index.nil? || index.keys.empty?\n      @searcher.search_with_cache(index, location: keymap)\n    end\n","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/iberianpig/fusuma/blob/43a7eb04fe6c0709a646be183a612e56e5f60a2e/lib/fusuma/config.rb#L90-L126","documentation":"Error \"Detect duplicate keys #{duplicates}\" thrown in iberianpig/fusuma.","triggerScenarios":"Thrown at lib/fusuma/config.rb:108 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Open the config file shown in the log and remove or merge the duplicate keys listed in the error message.","Ensure each key appears only once per mapping level in config.yml; YAML silently allows duplicates, so check nested sections too.","Run fusuma again after editing to confirm the duplicate keys are gone."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"43a7eb04fe6c0709a646be183a612e56e5f60a2e","analyzedAt":"2026-08-23T06:17:53.504Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}