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

Argument `#{splittable_args[index][0..5]}...` exceeds the ma

Error message

Argument `#{splittable_args[index][0..5]}...` exceeds the maximum command length when appended to command prefix and can't be split further

What it means

Error "Argument `#{splittable_args[index][0..5]}...` exceeds the maximum command length when appended to command prefix and can't be split further" thrown in sds/overcommit.

Source

Thrown at lib/overcommit/command_splitter.rb:119

      end

      # @return [Array<Array<String>, Integer>] tuple of arguments and new index
      def arguments_under_limit(splittable_args, start_index, byte_limit)
        index = start_index
        total_bytes = 0

        loop do
          break if index > splittable_args.length - 1

          total_bytes += splittable_args[index].bytesize
          break if total_bytes > byte_limit # Not enough room

          index += 1
        end

        if index == start_index
          # No argument was consumed; perhaps a really long argument?
          raise Overcommit::Exceptions::InvalidCommandArgs,
                "Argument `#{splittable_args[index][0..5]}...` exceeds the " \
                'maximum command length when appended to command prefix and ' \
                "can't be split further"
        end

        [splittable_args[start_index...index], index]
      end

      # Returns the maximum number of arguments allowed in a single command on
      # this system.
      #
      # @return [Integer]
      def max_command_length
        @max_command_length ||=
          if Gem.win_platform?
            # Windows is limited to 2048 since that is a worst-case scenario.
            # http://blogs.msdn.com/b/oldnewthing/archive/2003/12/10/56028.aspx
            2048

View on GitHub (pinned to fee0cd74b2)

Solutions

  1. Shorten the offending single argument (e.g. a very long file path) so it fits within the remaining command-length budget after the command prefix.
  2. Reduce the command prefix size so more room remains for splittable arguments.
  3. Exclude or rename extremely long paths, or run the hook over a narrower set of files.

When it happens

Trigger: Thrown at lib/overcommit/command_splitter.rb:119 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/959a090b11febcba. Report an issue: GitHub.