sds/overcommit · error · RuntimeError

RakeTarget: targets parameter is empty. Add at least one tas

Error message

RakeTarget: targets parameter is empty. Add at least one task to the targets parameter. Valid: Array of target names or String of target names

What it means

Error "RakeTarget: targets parameter is empty. Add at least one task to the targets parameter. Valid: Array of target names or String of target names" thrown in sds/overcommit.

Source

Thrown at lib/overcommit/hook/shared/rake_target.rb:12

# frozen_string_literal: true

module Overcommit::Hook::Shared
  # runs specified rake targets. It fails on the first non-
  # successful exit.
  #
  module RakeTarget
    def run
      targets = config['targets']

      if Array(targets).empty?
        raise 'RakeTarget: targets parameter is empty. Add at least one task to ' \
          'the targets parameter. Valid: Array of target names or String of ' \
          'target names'
      end

      targets.each do |task|
        result = execute(command + [task])
        unless result.success?
          return :fail, "Rake target #{task}:\n#{result.stdout}"
        end
      end
      :pass
    end
  end
end

View on GitHub (pinned to fee0cd74b2)

Solutions

  1. Add a non-empty `targets` array (or space-separated string) of rake task names to the hook's configuration in .overcommit.yml, e.g. `targets: ['spec', 'lint']`.
  2. Remove the hook from your configuration if you do not intend to run any rake targets.

When it happens

Trigger: Thrown at lib/overcommit/hook/shared/rake_target.rb:12 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of sds/overcommit@fee0cd74b2 (2026-08-23). Data as JSON: /api/errors/7223987f2a74f7ed. Report an issue: GitHub.