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

Unexpected output: no file found in '#{message}'

Error message

Unexpected output: no file found in '#{message}'

What it means

Error "Unexpected output: no file found in '#{message}'" thrown in sds/overcommit.

Source

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

                  "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')

        if match[:file].to_s.empty?
          raise Overcommit::Exceptions::MessageProcessingError,
                "Unexpected output: no file found in '#{message}'"
        end

        match[:file]
      end

      def extract_line(match, message)
        return unless match.names.include?('line')

        Integer(match[:line])
      rescue ArgumentError, TypeError
        raise Overcommit::Exceptions::MessageProcessingError,
              "Unexpected output: invalid line number found in '#{message}'"
      end

      def extract_type(match, message, type_categorizer)
        if type_categorizer
          type_match = match.names.include?('type') ? match[:type] : nil

View on GitHub (pinned to fee0cd74b2)

Solutions

  1. Ensure each line of the tool's output starts with a file path (e.g. `path/to/file:1: error: msg`).
  2. Update the tool's flags or the hook's parsing so output lines include file names that the extractor can find.

When it happens

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