{"record":{"id":"272845d9a29568ba","repo":"EugenMayer/docker-sync","slug":"unknown-watch-strategy-options-watch-strategy","errorCode":null,"errorMessage":"Unknown watch_strategy #{@options['watch_strategy']}","messagePattern":"Unknown watch_strategy #(.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/docker-sync/sync_process.rb","lineNumber":69,"sourceCode":"      when 'native_osx'\n        @sync_strategy = DockerSync::SyncStrategy::NativeOsx.new(@sync_name, @options)\n      else\n        raise \"Unknown sync_strategy #{@options['sync_strategy']}\"\n      end\n    end\n\n    def set_watch_strategy\n      case @options['watch_strategy']\n      when 'fswatch'\n        @watch_strategy = DockerSync::WatchStrategy::Fswatch.new(@sync_name, @options)\n      when 'dummy'\n        @watch_strategy = DockerSync::WatchStrategy::Dummy.new(@sync_name, @options)\n      when 'unison'\n        @watch_strategy = DockerSync::WatchStrategy::Unison.new(@sync_name, @options)\n      when 'remotelogs'\n        @watch_strategy = DockerSync::WatchStrategy::Remote_logs.new(@sync_name, @options)\n      else\n        raise \"Unknown watch_strategy #{@options['watch_strategy']}\"\n      end\n    end\n\n    def get_host_ip_default\n      return '127.0.0.1' unless Dependencies::Docker::Driver.docker_toolbox?\n\n      cmd = 'docker-machine ip $(docker-machine active)'\n      stdout, stderr, exit_status = Open3.capture3(cmd)\n      unless exit_status.success?\n        raise \"Error getting sync_host_ip automatically, exit code #{$?.exitstatus} ... #{stderr}\"\n      end\n      stdout.gsub(\"\\n\",'')\n    end\n\n    def run\n      @sync_strategy.run\n      @watch_strategy.run\n    end","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/EugenMayer/docker-sync/blob/4eab6de164d44c724c739c17bd574efa9008aae1/lib/docker-sync/sync_process.rb#L51-L87","documentation":"SyncProcess#set_watch_strategy raises on any options['watch_strategy'] outside 'fswatch', 'dummy', 'unison', 'remotelogs' (lib/docker-sync/sync_process.rb:69). Note the asymmetry with config-file handling: ProjectConfig#watch_strategy_for maps 'disable' to 'dummy' and falls back to defaults (project_config.rb:134-143), but SyncProcess does neither, so constructing it directly with 'disable' raises. Values are case-sensitive, untrimmed, and 'remotelogs' is one word (the class is WatchStrategy::Remote_logs).","triggerScenarios":"SyncProcess.new with 'watch_strategy' => 'disable' (fine inside docker-sync.yml, rejected when passed straight to SyncProcess), misspellings like 'remote_logs' or 'fswach', capitalized values like 'Dummy', or nil from a hand-built options hash.","commonSituations":"Reusing config-file vocabulary ('disable') in direct API code; misspelling remotelogs as remote_logs; options assembled from ENV or user input; docker-sync versions whose accepted watcher sets differ.","solutions":["Use one of the four exact values: 'fswatch', 'dummy', 'unison', 'remotelogs', all lowercase.","Translate 'disable' to 'dummy' yourself when constructing SyncProcess directly.","Spell the log watcher 'remotelogs' (one word, no underscore).","Feed SyncProcess with options that came through ProjectConfig normalization rather than a raw hash."],"exampleFix":"# before ('disable' is config-file syntax; SyncProcess wants 'dummy')\nprocess = DockerSync::SyncProcess.new('appcode-sync',\n  'src' => './src', 'watch_strategy' => 'disable')\n\n# after\nprocess = DockerSync::SyncProcess.new('appcode-sync',\n  'src' => './src', 'watch_strategy' => 'dummy')","handlingStrategy":"type-guard","validationCode":"ALLOWED_WATCH = %w[fswatch dummy unison remotelogs].freeze\nvalue = options['watch_strategy'] == 'disable' ? 'dummy' : options['watch_strategy']\nabort \"watch_strategy must be one of: #{ALLOWED_WATCH.join(', ')}\" unless ALLOWED_WATCH.include?(value)\nprocess = DockerSync::SyncProcess.new(name, options.merge('watch_strategy' => value))","typeGuard":"WATCH_STRATEGIES = %w[fswatch dummy unison remotelogs].freeze\n\ndef watch_strategy?(value)\n  value.is_a?(String) && WATCH_STRATEGIES.include?(value)\nend","tryCatchPattern":"begin\n  DockerSync::SyncProcess.new(name, options)\nrescue RuntimeError => e\n  raise unless e.message.start_with?('Unknown watch_strategy')\n  abort \"unsupported watch_strategy #{options['watch_strategy'].inspect}\"\nend","preventionTips":["Remember 'disable' is config-file syntax; SyncProcess wants 'dummy'.","Spell the log watcher 'remotelogs' (one word, no underscore).","Centralize the watcher whitelist next to the code that builds options.","Add a unit test over the accepted watcher list."],"tags":["docker-sync","ruby","configuration","strategy","enum"],"backgroundTag":"invalid-config-value","analyzedSha":"4eab6de164d44c724c739c17bd574efa9008aae1","analyzedAt":"2026-08-23T10:20:11.101Z","schemaVersion":2},"datasetVersion":"2026-08-23T13:39:53.451Z"}