ankane/pgsync · error · Error

Config file not found: #{file}

Error message

Config file not found: #{file}

What it means

Error "Config file not found: #{file}" thrown in ankane/pgsync.

Source

Thrown at lib/pgsync/sync.rb:94

    def config
      @config ||= begin
        file = config_file
        if file
          begin
            # same options as YAML.load_file
            File.open(file, "r:bom|utf-8") do |f|
              # changed to keyword arguments in 3.1.0.pre1
              # https://github.com/ruby/psych/commit/c79ed445b4b3f8c9adf3da13bca3c976ddfae258
              if Psych::VERSION.to_f >= 3.1
                YAML.safe_load(f, aliases: true, filename: file) || {}
              else
                YAML.safe_load(f, [], [], true, file) || {}
              end
            end
          rescue Psych::SyntaxError => e
            raise Error, e.message
          rescue Errno::ENOENT
            raise Error, "Config file not found: #{file}"
          end
        else
          {}
        end
      end
    end

    def config_file
      if @options[:config]
        @options[:config]
      elsif @options[:db]
        file = db_config_file(@options[:db])
        search_tree(file) || file
      else
        search_tree(".pgsync.yml")
      end
    end

View on GitHub (pinned to 57bdddf5db)

When it happens

Trigger: Thrown at lib/pgsync/sync.rb:94 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ankane/pgsync@57bdddf5db (2026-08-23). Data as JSON: /api/errors/99919fe8d06980ec. Report an issue: GitHub.