iberianpig/fusuma · error · InvalidFileError

Detect duplicate keys #{duplicates}

Error message

Detect duplicate keys #{duplicates}

What it means

Error "Detect duplicate keys #{duplicates}" thrown in iberianpig/fusuma.

Source

Thrown at lib/fusuma/config.rb:108

      Config::Searcher.find_context(request_context, fallbacks) do
        ret = Config.search(base)
        if ret&.key?(key)
          return ret
        end
      end
      {}
    end

    # @return [Hash] If check passes
    # @raise [InvalidFileError] If check does not pass
    #: (String) -> Array[Hash[Symbol, untyped]]
    def validate(path)
      duplicates = []
      YAMLDuplicationChecker.check(File.read(path), path) do |ignored, duplicate| # steep:ignore UnexpectedBlockGiven
        MultiLogger.error "#{path}: #{ignored.value} is duplicated"
        duplicates << duplicate.value
      end
      raise InvalidFileError, "Detect duplicate keys #{duplicates}" unless duplicates.empty?

      yamls = YAML.load_stream(File.read(path)).compact # steep:ignore NoMethod
      yamls.map do |yaml|
        raise InvalidFileError, "Invalid config.yml: #{path}" unless yaml.is_a? Hash

        yaml.deep_symbolize_keys
      end
    rescue Psych::SyntaxError => e
      raise InvalidFileError, "Invalid syntax: #{path} #{e.message}"
    end

    # @param index [Index]
    #: (Fusuma::Config::Index) -> (String | Hash[untyped, untyped] | Integer | Float)?
    def search(index)
      return nil if index.nil? || index.keys.empty?
      @searcher.search_with_cache(index, location: keymap)
    end

View on GitHub (pinned to 43a7eb04fe)

Solutions

  1. Open the config file shown in the log and remove or merge the duplicate keys listed in the error message.
  2. Ensure each key appears only once per mapping level in config.yml; YAML silently allows duplicates, so check nested sections too.
  3. Run fusuma again after editing to confirm the duplicate keys are gone.

When it happens

Trigger: Thrown at lib/fusuma/config.rb:108 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of iberianpig/fusuma@43a7eb04fe (2026-08-23). Data as JSON: /api/errors/9ce95d852cbe18c2. Report an issue: GitHub.