{"record":{"id":"7a25be8868b119a6","repo":"sds/overcommit","slug":"unexpected-output-unable-to-determine-line-number","errorCode":null,"errorMessage":"Unexpected output: unable to determine line number or type of error/warning for output:\n#{output_messages[index..].join(\"\\n\")}","messagePattern":"Unexpected output: unable to determine line number or type of error/warning for output:\n#(.+?)","errorType":"exception","errorClass":"Overcommit::Exceptions::MessageProcessingError","httpStatus":null,"severity":"error","filePath":"lib/overcommit/utils/messages_utils.rb","lineNumber":26,"sourceCode":"      # messages in output.\n      #\n      # Assumes each element of `output` is a separate error/warning with all\n      # information necessary to identify it.\n      #\n      # @param output_messages [Array<String>] unprocessed error/warning messages\n      # @param regex [Regexp] regular expression defining `file`, `line` and\n      #   `type` capture groups used to extract file locations and error/warning\n      #   type from each line of output\n      # @param type_categorizer [Proc] function executed against the `type`\n      #   capture group to convert it to a `:warning` or `:error` symbol. Assumes\n      #   `:error` if `nil`.\n      # @raise [Overcommit::Exceptions::MessageProcessingError] line of output did\n      #   not match regex\n      # @return [Array<Message>]\n      def extract_messages(output_messages, regex, type_categorizer = nil)\n        output_messages.map.with_index do |message, index|\n          unless match = message.match(regex)\n            raise Overcommit::Exceptions::MessageProcessingError,\n                  'Unexpected output: unable to determine line number or type ' \\\n                  \"of error/warning for output:\\n\" \\\n                  \"#{output_messages[index..].join(\"\\n\")}\"\n          end\n\n          file = extract_file(match, message)\n          line = extract_line(match, message) if match.names.include?('line') && match[:line]\n          type = extract_type(match, message, type_categorizer)\n\n          Overcommit::Hook::Message.new(type, file, line, message)\n        end\n      end\n\n      private\n\n      def extract_file(match, message)\n        return unless match.names.include?('file')\n","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/sds/overcommit/blob/fee0cd74b26eb81f64b43b7fab17bbb541575cc4/lib/overcommit/utils/messages_utils.rb#L8-L44","documentation":"Error \"Unexpected output: unable to determine line number or type of error/warning for output:\n#{output_messages[index..].join(\"\\n\")}\" thrown in sds/overcommit.","triggerScenarios":"Thrown at lib/overcommit/utils/messages_utils.rb:26 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Make the tool's output match the format the hook's message extractor expects (typically `file:line: type: message`, one message per line).","Adjust the hook's extraction logic (e.g. a custom `extract_messages` regex) to match your tool's actual output format.","Pin the tool to a version whose output format matches what the hook expects."],"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"}