EugenMayer/docker-sync · error

no syncs defined

Error message

no syncs defined

What it means

After the version checks pass, validate_config! requires a top-level 'syncs' key and raises ERROR_MISSING_SYNCS ('no syncs defined') when it is absent (lib/docker-sync/config/project_config.rb:77). The check tests key presence only: syncs: {} (present but empty) passes validation and instead yields zero sync processes downstream. So this exact message means the syncs key itself is missing from the parsed config.

Source

Thrown at lib/docker-sync/config/project_config.rb:77

      config['syncs'].any? { |name, sync_config|
        sync_config['sync_strategy'] == 'rsync'
      }
    end

    def fswatch_required?
      # noinspection RubyUnusedLocalVariable
      config['syncs'].any? { |name, sync_config|
        sync_config['watch_strategy'] == 'fswatch'
      }
    end

    private

      def validate_config!
        raise error_missing_given_config if config.nil?
        raise ERROR_MISSING_CONFIG_VERSION unless config.key?('version')
        raise ERROR_MISMATCH_CONFIG_VERSION unless config['version'].to_s == REQUIRED_CONFIG_VERSION
        raise ERROR_MISSING_SYNCS unless config.key?('syncs')

        validate_syncs_config!
      end

      def validate_syncs_config!
        config['syncs'].each do |name, sync_config|
          validate_sync_config(name, sync_config)
        end
      end

      def validate_sync_config(name, sync_config)
        config_mandatory = %w[src]
        #TODO: Implement autodisovery for other strategies
        config_mandatory.push('sync_host_port') if sync_config['sync_strategy'] == 'rsync'
        config_mandatory.each do |key|
          raise ("#{name} does not have #{key} configuration value set - this is mandatory") unless sync_config.key?(key)
        end
      end

View on GitHub (pinned to 4eab6de164)

Solutions

  1. Add a top-level syncs: mapping with at least one named sync carrying a src: entry (src is mandatory per validate_sync_config, project_config.rb:89).
  2. Verify YAML indentation: syncs: must sit at column 0 with its sync entries indented beneath it.
  3. If you intentionally want zero syncs for now, write syncs: {} so the key exists.

Example fix

# before
version: "2"

# after
version: "2"
syncs:
  appcode-sync:
    src: './src'
Defensive patterns

Strategy: validation

Validate before calling

require 'yaml'

raw = YAML.safe_load(File.read('docker-sync.yml')) || {}
abort 'docker-sync.yml: missing top-level syncs key' unless raw.key?('syncs')
warn 'syncs is empty: no sync processes will run' if raw['syncs'].to_a.empty?
config = DockerSync::ProjectConfig.new

Try / catch

begin
  DockerSync::ProjectConfig.new
rescue RuntimeError => e
  raise unless e.message == DockerSync::ProjectConfig::ERROR_MISSING_SYNCS
  # syncs key absent: add a top-level syncs: mapping with at least one entry
end

Prevention

When it happens

Trigger: ProjectConfig.new with a config that has version: "2" but no top-level syncs: key: a file with only the header, entries nested under a misspelled key (sync:, syncs-config:), or sync entries pasted at the wrong indentation level so YAML demoted them.

Common situations: Half-finished first-time setup; YAML indentation mistakes that turn syncs into a nested key of something else; renaming the key while refactoring a config.

Related errors


AI-assisted analysis of EugenMayer/docker-sync@4eab6de164 (2026-08-23). Data as JSON: /api/errors/c29ea91d48bb0d42. Report an issue: GitHub.