{"record":{"id":"e314496ae7c49211","repo":"ankane/pgsync","slug":"this-should-never-happen-please-file-a-bug","errorCode":null,"errorMessage":"This should never happen. Please file a bug.","messagePattern":"This should never happen\\. Please file a bug\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/pgsync/task.rb","lineNumber":79,"sourceCode":"\n        missing_sequences = from_sequences - to_sequences\n        notes << \"Missing sequences: #{missing_sequences.join(\", \")}\" if missing_sequences.any?\n\n        from_types = from_columns.map { |c| [c[:name], c[:type]] }.to_h\n        to_types = to_columns.map { |c| [c[:name], c[:type]] }.to_h\n        different_types = []\n        shared_fields.each do |field|\n          if from_types[field] != to_types[field]\n            different_types << \"#{field} (#{from_types[field]} -> #{to_types[field]})\"\n          end\n        end\n        notes << \"Different column types: #{different_types.join(\", \")}\" if different_types.any?\n      end\n      notes\n    end\n\n    def sync_data\n      raise Error, \"This should never happen. Please file a bug.\" if shared_fields.empty?\n\n      sql_clause = String.new(\"\")\n      sql_clause << \" #{opts[:sql]}\" if opts[:sql]\n\n      bad_fields = opts[:no_rules] ? [] : config[\"data_rules\"]\n      primary_key = to_primary_key\n      copy_fields = shared_fields.map { |f| f2 = bad_fields.to_a.find { |bf, _| rule_match?(table, f, bf) }; f2 ? \"#{apply_strategy(f2[1], table, f, primary_key)} AS #{quote_ident(f)}\" : \"#{quoted_table}.#{quote_ident(f)}\" }.join(\", \")\n      fields = shared_fields.map { |f| quote_ident(f) }.join(\", \")\n\n      copy_to_command = \"COPY (SELECT #{copy_fields} FROM #{quoted_table}#{sql_clause}) TO STDOUT\"\n      if opts[:in_batches]\n        raise Error, \"Primary key required for --in-batches\" if primary_key.empty?\n        primary_key = primary_key.first\n\n        destination.truncate(table) if opts[:truncate]\n\n        from_max_id = source.max_id(table, primary_key)\n        to_max_id = destination.max_id(table, primary_key) + 1","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/ankane/pgsync/blob/57bdddf5db506d329b51cb3376379dc3a2559010/lib/pgsync/task.rb#L61-L97","documentation":"Error \"This should never happen. Please file a bug.\" thrown in ankane/pgsync.","triggerScenarios":"Thrown at lib/pgsync/task.rb:79 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":"57bdddf5db506d329b51cb3376379dc3a2559010","analyzedAt":"2026-08-23T11:18:48.887Z","schemaVersion":2},"datasetVersion":"2026-08-23T16:17:53.355Z"}