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

Unable to load '#{hook_type}' hook context: '#{e}'

Error message

Unable to load '#{hook_type}' hook context: '#{e}'

What it means

Error "Unable to load '#{hook_type}' hook context: '#{e}'" thrown in sds/overcommit.

Source

Thrown at lib/overcommit/hook_context.rb:15

# frozen_string_literal: true

# Utility module which manages the creation of {HookContext}s.
module Overcommit::HookContext
  def self.create(hook_type, config, args, input, **cli_options)
    hook_type_class = Overcommit::Utils.camel_case(hook_type)
    underscored_hook_type = Overcommit::Utils.snake_case(hook_type)

    require "overcommit/hook_context/#{underscored_hook_type}"

    Overcommit::HookContext.const_get(hook_type_class).new(config, args, input, **cli_options)
  rescue LoadError, NameError => e
    # Could happen when a symlink was created for a hook type Overcommit does
    # not yet support.
    raise Overcommit::Exceptions::HookContextLoadError,
          "Unable to load '#{hook_type}' hook context: '#{e}'",
          e.backtrace
  end
end

View on GitHub (pinned to fee0cd74b2)

Solutions

  1. Run hooks from the correct git hook stage; a symlink may exist for a hook type Overcommit does not support — remove unsupported hook symlinks from .git/hooks.
  2. Reinstall the hooks with `overcommit --install` if the hook scripts are stale or mismatched.
  3. Read the inner error shown in the message (LoadError or NameError) for the exact load failure.

When it happens

Trigger: Thrown at lib/overcommit/hook_context.rb:15 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/e47045dbcef7a835. Report an issue: GitHub.