EugenMayer/docker-sync · error
Unknown watch_strategy #{@options['watch_strategy']}
Error message
Unknown watch_strategy #{@options['watch_strategy']} What it means
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).
Source
Thrown at lib/docker-sync/sync_process.rb:69
when 'native_osx'
@sync_strategy = DockerSync::SyncStrategy::NativeOsx.new(@sync_name, @options)
else
raise "Unknown sync_strategy #{@options['sync_strategy']}"
end
end
def set_watch_strategy
case @options['watch_strategy']
when 'fswatch'
@watch_strategy = DockerSync::WatchStrategy::Fswatch.new(@sync_name, @options)
when 'dummy'
@watch_strategy = DockerSync::WatchStrategy::Dummy.new(@sync_name, @options)
when 'unison'
@watch_strategy = DockerSync::WatchStrategy::Unison.new(@sync_name, @options)
when 'remotelogs'
@watch_strategy = DockerSync::WatchStrategy::Remote_logs.new(@sync_name, @options)
else
raise "Unknown watch_strategy #{@options['watch_strategy']}"
end
end
def get_host_ip_default
return '127.0.0.1' unless Dependencies::Docker::Driver.docker_toolbox?
cmd = 'docker-machine ip $(docker-machine active)'
stdout, stderr, exit_status = Open3.capture3(cmd)
unless exit_status.success?
raise "Error getting sync_host_ip automatically, exit code #{$?.exitstatus} ... #{stderr}"
end
stdout.gsub("\n",'')
end
def run
@sync_strategy.run
@watch_strategy.run
endView on GitHub (pinned to 4eab6de164)
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.
Example fix
# before ('disable' is config-file syntax; SyncProcess wants 'dummy')
process = DockerSync::SyncProcess.new('appcode-sync',
'src' => './src', 'watch_strategy' => 'disable')
# after
process = DockerSync::SyncProcess.new('appcode-sync',
'src' => './src', 'watch_strategy' => 'dummy') Defensive patterns
Strategy: type-guard
Validate before calling
ALLOWED_WATCH = %w[fswatch dummy unison remotelogs].freeze
value = options['watch_strategy'] == 'disable' ? 'dummy' : options['watch_strategy']
abort "watch_strategy must be one of: #{ALLOWED_WATCH.join(', ')}" unless ALLOWED_WATCH.include?(value)
process = DockerSync::SyncProcess.new(name, options.merge('watch_strategy' => value)) Type guard
WATCH_STRATEGIES = %w[fswatch dummy unison remotelogs].freeze def watch_strategy?(value) value.is_a?(String) && WATCH_STRATEGIES.include?(value) end
Try / catch
begin
DockerSync::SyncProcess.new(name, options)
rescue RuntimeError => e
raise unless e.message.start_with?('Unknown watch_strategy')
abort "unsupported watch_strategy #{options['watch_strategy'].inspect}"
end Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Unknown sync_strategy #{@options['sync_strategy']}
- No docker-sync.yml configuration found in your path ( traver
- Your docker-sync.yml file does not include a version: "2"(Ad
- Your docker-sync.yml file does not match the required versio
- no syncs defined
AI-assisted analysis of EugenMayer/docker-sync@4eab6de164 (2026-08-23).
Data as JSON: /api/errors/272845d9a29568ba.
Report an issue: GitHub.