{"record":{"id":"22cd6508023ceda3","repo":"ankane/pgsync","slug":"danger-add-to-safe-true-to-pgsync-yml-if-th","errorCode":null,"errorMessage":"Danger! Add `to_safe: true` to `.pgsync.yml` if the destination is not localhost or 127.0.0.1","messagePattern":"Danger! Add `to_safe: true` to `\\.pgsync\\.yml` if the destination is not localhost or 127\\.0\\.0\\.1","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/pgsync/sync.rb","lineNumber":34,"sourceCode":"      # only resolve commands from config, not CLI arguments\n      [:to, :from].each do |opt|\n        opts[opt] ||= resolve_source(config[opt.to_s])\n      end\n\n      # merge other config\n      [:to_safe, :exclude, :schemas].each do |opt|\n        opts[opt] ||= config[opt.to_s]\n      end\n\n      if args.size > 2\n        raise Error, \"Usage:\\n    pgsync [options]\"\n      end\n\n      raise Error, \"No source\" unless source.exists?\n      raise Error, \"No destination\" unless destination.exists?\n\n      unless opts[:to_safe] || destination.local?\n        raise Error, \"Danger! Add `to_safe: true` to `.pgsync.yml` if the destination is not localhost or 127.0.0.1\"\n      end\n\n      print_description(\"From\", source)\n      print_description(\"To\", destination)\n\n      if (opts[:preserve] || opts[:overwrite]) && destination.server_version_num < 90500\n        raise Error, \"Postgres 9.5+ is required for --preserve and --overwrite\"\n      end\n\n      resolver = TaskResolver.new(args: args, opts: opts, source: source, destination: destination, config: config, first_schema: first_schema)\n      tasks =\n        resolver.tasks.map do |task|\n          Task.new(source: source, destination: destination, config: config, table: task[:table], opts: opts.merge(sql: task[:sql]))\n        end\n\n      if opts[:in_batches] && tasks.size > 1\n        raise Error, \"Cannot use --in-batches with multiple tables\"\n      end","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/ankane/pgsync/blob/57bdddf5db506d329b51cb3376379dc3a2559010/lib/pgsync/sync.rb#L16-L52","documentation":"Error \"Danger! Add `to_safe: true` to `.pgsync.yml` if the destination is not localhost or 127.0.0.1\" thrown in ankane/pgsync.","triggerScenarios":"Thrown at lib/pgsync/sync.rb:34 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"}