sds/overcommit · error · RuntimeError
This expects a block!
Error message
This expects a block!
What it means
Error "This expects a block!" thrown in sds/overcommit.
Source
Thrown at lib/overcommit/hook/prepare_commit_msg/base.rb:14
# frozen_string_literal: true
require 'forwardable'
module Overcommit::Hook::PrepareCommitMsg
# Functionality common to all prepare-commit-msg hooks.
class Base < Overcommit::Hook::Base
extend Forwardable
def_delegators :@context,
:commit_message_filename, :commit_message_source, :commit, :lock
def modify_commit_message
raise 'This expects a block!' unless block_given?
# NOTE: this assumes all the hooks of the same type share the context's
# memory. If that's not the case, this won't work.
lock.synchronize do
contents = File.read(commit_message_filename)
File.open(commit_message_filename, 'w') do |f|
f << (yield contents)
end
end
end
end
end
View on GitHub (pinned to fee0cd74b2)
Solutions
- Call the method with a block (e.g. `modify_commit_message { |msg| ... }`) as required by the prepare-commit-msg base API.
- Review your custom prepare-commit-msg hook code to ensure every call into this helper passes a block.
When it happens
Trigger: Thrown at lib/overcommit/hook/prepare_commit_msg/base.rb:14 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/afda3ada2f486494.
Report an issue: GitHub.