sds/overcommit · error · Overcommit::Exceptions::ConfigurationError

One or more hooks had invalid names

Error message

One or more hooks had invalid names

What it means

Error "One or more hooks had invalid names" thrown in sds/overcommit.

Source

Thrown at lib/overcommit/configuration_validator.rb:118

      Overcommit::Utils.supported_hook_type_classes.each do |hook_type|
        hash.fetch(hook_type) { {} }.each_key do |hook_name|
          next if hook_name == 'ALL'

          unless hook_name.match?(/\A[A-Za-z0-9]+\z/)
            errors << "#{hook_type}::#{hook_name} has an invalid name " \
                      "#{hook_name}. It must contain only alphanumeric " \
                      'characters (no underscores or dashes, etc.)'
          end
        end
      end

      if errors.any?
        if @log
          @log.error errors.join("\n")
          @log.newline
        end
        raise Overcommit::Exceptions::ConfigurationError,
              'One or more hooks had invalid names'
      end
    end

    # Prints a warning if there are any hooks listed in the configuration
    # without `enabled` explicitly set.
    def check_for_missing_enabled_option(hash)
      return unless @log

      any_warnings = false

      Overcommit::Utils.supported_hook_type_classes.each do |hook_type|
        hash.fetch(hook_type) { {} }.each do |hook_name, hook_config|
          next if hook_name == 'ALL'

          if hook_config['enabled'].nil?
            @log.warning "#{hook_type}::#{hook_name} hook does not explicitly " \
                         'set `enabled` option in .overcommit.yml'

View on GitHub (pinned to fee0cd74b2)

Solutions

  1. Rename hook entries in .overcommit.yml so names contain only alphanumeric characters (no underscores or dashes), e.g. `RuboCop`, `TrailingWhitespace`.
  2. Check the error lines printed above the message; they list each invalid hook name.
  3. Remove any hook entries that are not real built-in or plugin hooks.

When it happens

Trigger: Thrown at lib/overcommit/configuration_validator.rb:118 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/2d3a48196daa0882. Report an issue: GitHub.