ankane/pgsync · error · Error

Specify either --db or --config, not both

Error message

Specify either --db or --config, not both

What it means

Error "Specify either --db or --config, not both" thrown in ankane/pgsync.

Source

Thrown at lib/pgsync/client.rb:16

module PgSync
  class Client
    include Utils

    def initialize(args)
      @args = args
      output.sync = true
    end

    def perform
      result = Slop::Parser.new(slop_options).parse(@args)
      arguments = result.arguments
      options = result.to_h
      options[:defer_constraints_v2] ||= options[:defer_constraints]

      raise Error, "Specify either --db or --config, not both" if options[:db] && options[:config]
      raise Error, "Cannot use --overwrite with --in-batches" if options[:overwrite] && options[:in_batches]

      if options[:version]
        log VERSION
      elsif options[:help]
        log slop_options
      elsif options[:init]
        Init.new(arguments, options).perform
      else
        Sync.new(arguments, options).perform
      end
    rescue => e
      # Error, PG::ConnectionBad, Slop::Error
      raise e if options && options[:debug]
      abort colorize(e.message.strip, :red)
    end

    def self.start

View on GitHub (pinned to 57bdddf5db)

When it happens

Trigger: Thrown at lib/pgsync/client.rb:16 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/3cfa0697ca8925b5. Report an issue: GitHub.