{"record":{"id":"d13656335a0997e6","repo":"EugenMayer/docker-sync","slug":"unknown-sync-strategy-options-sync-strategy","errorCode":null,"errorMessage":"Unknown sync_strategy #{@options['sync_strategy']}","messagePattern":"Unknown sync_strategy #(.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/docker-sync/sync_process.rb","lineNumber":54,"sourceCode":"      @options = defaults.merge(options)\n      @sync_strategy = nil\n      @watch_strategy = nil\n      set_sync_strategy\n      set_watch_strategy\n    end\n\n    def set_sync_strategy\n      case @options['sync_strategy']\n      when 'rsync'\n        @sync_strategy = DockerSync::SyncStrategy::Rsync.new(@sync_name, @options)\n      when 'unison'\n        @sync_strategy = DockerSync::SyncStrategy::Unison.new(@sync_name, @options)\n      when 'native'\n        @sync_strategy = DockerSync::SyncStrategy::Native.new(@sync_name, @options)\n      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","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/EugenMayer/docker-sync/blob/4eab6de164d44c724c739c17bd574efa9008aae1/lib/docker-sync/sync_process.rb#L36-L72","documentation":"SyncProcess#set_sync_strategy is a case over options['sync_strategy'] whose else branch raises 'Unknown sync_strategy <value>' (lib/docker-sync/sync_process.rb:54). Accepted values are exactly 'rsync', 'unison', 'native', 'native_osx': case-sensitive, no whitespace trimming. Configs that flow through ProjectConfig never see this raise because sync_strategy_for (project_config.rb:124-132) silently substitutes a platform default for unknown values, so in practice it hits code constructing SyncProcess directly with a hand-built options hash, or values valid only in other docker-sync versions.","triggerScenarios":"DockerSync::SyncProcess.new(name, options) with options['sync_strategy'] outside the four accepted strings: 'Unison', 'native-osx', 'rsync ' (trailing space), nil, or a strategy from a different docker-sync release such as 'unison_ssh' on a version that does not ship it.","commonSituations":"Typos or wrong casing in hand-rolled options hashes; strategy values sourced from ENV vars or user input; code written against a newer or older gem; options mutated upstream so the key ends up nil.","solutions":["Set sync_strategy to one of the four exact strings: 'rsync', 'unison', 'native', 'native_osx'.","Check casing and trailing whitespace on the value coming from YAML, ENV, or user input.","If the value looks right, compare it against the case list in your installed gem's lib/docker-sync/sync_process.rb; your code may assume a strategy this version does not ship.","Build options through ProjectConfig (it normalizes and defaults strategies) instead of hand-assembling the hash."],"exampleFix":"# before\nprocess = DockerSync::SyncProcess.new('appcode-sync',\n  'src' => './src', 'sync_strategy' => 'native-osx')\n\n# after\nprocess = DockerSync::SyncProcess.new('appcode-sync',\n  'src' => './src', 'sync_strategy' => 'native_osx')","handlingStrategy":"type-guard","validationCode":"ALLOWED_SYNC = %w[rsync unison native native_osx].freeze\nunless ALLOWED_SYNC.include?(options['sync_strategy'])\n  abort \"sync_strategy must be one of: #{ALLOWED_SYNC.join(', ')}\"\nend\nprocess = DockerSync::SyncProcess.new(name, options)","typeGuard":"SYNC_STRATEGIES = %w[rsync unison native native_osx].freeze\n\ndef sync_strategy?(value)\n  value.is_a?(String) && SYNC_STRATEGIES.include?(value)\nend","tryCatchPattern":"begin\n  DockerSync::SyncProcess.new(name, options)\nrescue RuntimeError => e\n  raise unless e.message.start_with?('Unknown sync_strategy')\n  abort \"unsupported sync_strategy #{options['sync_strategy'].inspect}\"\nend","preventionTips":["Reference frozen constant lists instead of repeating string literals.","Validate strategy values where options are assembled, before containers start.","Cover strategy selection with a test enumerating the supported values.","Derive options from ProjectConfig output so defaults and whitelists are applied for you."],"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"}