{"record":{"id":"afda3ada2f486494","repo":"sds/overcommit","slug":"this-expects-a-block","errorCode":null,"errorMessage":"This expects a block!","messagePattern":"This expects a block!","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"lib/overcommit/hook/prepare_commit_msg/base.rb","lineNumber":14,"sourceCode":"# frozen_string_literal: true\n\nrequire 'forwardable'\n\nmodule Overcommit::Hook::PrepareCommitMsg\n  # Functionality common to all prepare-commit-msg hooks.\n  class Base < Overcommit::Hook::Base\n    extend Forwardable\n\n    def_delegators :@context,\n                   :commit_message_filename, :commit_message_source, :commit, :lock\n\n    def modify_commit_message\n      raise 'This expects a block!' unless block_given?\n\n      # NOTE: this assumes all the hooks of the same type share the context's\n      # memory. If that's not the case, this won't work.\n      lock.synchronize do\n        contents = File.read(commit_message_filename)\n        File.open(commit_message_filename, 'w') do |f|\n          f << (yield contents)\n        end\n      end\n    end\n  end\nend\n","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/sds/overcommit/blob/fee0cd74b26eb81f64b43b7fab17bbb541575cc4/lib/overcommit/hook/prepare_commit_msg/base.rb#L1-L27","documentation":"Error \"This expects a block!\" thrown in sds/overcommit.","triggerScenarios":"Thrown at lib/overcommit/hook/prepare_commit_msg/base.rb:14 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fee0cd74b26eb81f64b43b7fab17bbb541575cc4","analyzedAt":"2026-08-23T04:07:28.153Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}