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

Unexpected output: unable to determine line number or type o

Error message

Unexpected output: unable to determine line number or type of error/warning for output:
#{output_messages[index..].join("\n")}

What it means

Error "Unexpected output: unable to determine line number or type of error/warning for output: #{output_messages[index..].join("\n")}" thrown in sds/overcommit.

Source

Thrown at lib/overcommit/utils/messages_utils.rb:26

      # messages in output.
      #
      # Assumes each element of `output` is a separate error/warning with all
      # information necessary to identify it.
      #
      # @param output_messages [Array<String>] unprocessed error/warning messages
      # @param regex [Regexp] regular expression defining `file`, `line` and
      #   `type` capture groups used to extract file locations and error/warning
      #   type from each line of output
      # @param type_categorizer [Proc] function executed against the `type`
      #   capture group to convert it to a `:warning` or `:error` symbol. Assumes
      #   `:error` if `nil`.
      # @raise [Overcommit::Exceptions::MessageProcessingError] line of output did
      #   not match regex
      # @return [Array<Message>]
      def extract_messages(output_messages, regex, type_categorizer = nil)
        output_messages.map.with_index do |message, index|
          unless match = message.match(regex)
            raise Overcommit::Exceptions::MessageProcessingError,
                  'Unexpected output: unable to determine line number or type ' \
                  "of error/warning for output:\n" \
                  "#{output_messages[index..].join("\n")}"
          end

          file = extract_file(match, message)
          line = extract_line(match, message) if match.names.include?('line') && match[:line]
          type = extract_type(match, message, type_categorizer)

          Overcommit::Hook::Message.new(type, file, line, message)
        end
      end

      private

      def extract_file(match, message)
        return unless match.names.include?('file')

View on GitHub (pinned to fee0cd74b2)

Solutions

  1. Make the tool's output match the format the hook's message extractor expects (typically `file:line: type: message`, one message per line).
  2. Adjust the hook's extraction logic (e.g. a custom `extract_messages` regex) to match your tool's actual output format.
  3. Pin the tool to a version whose output format matches what the hook expects.

When it happens

Trigger: Thrown at lib/overcommit/utils/messages_utils.rb:26 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/7a25be8868b119a6. Report an issue: GitHub.