sds/overcommit · error · Overcommit::Exceptions::InvalidCommandArgs
Cannot pipe commands with the `execute` helper
Error message
Cannot pipe commands with the `execute` helper
What it means
Error "Cannot pipe commands with the `execute` helper" thrown in sds/overcommit.
Source
Thrown at lib/overcommit/utils.rb:206
# filtering of the command before executing it.
#
# The `args` option provides a convenient way of splitting up long
# argument lists which would otherwise exceed the maximum command line
# length of the OS. It will break up the list into chunks and run the
# command with the same prefix `initial_args`, finally combining the
# output together at the end.
#
# This requires that the external command you are running can have its
# work split up in this way and still produce the same resultant output
# when outputs of the individual commands are concatenated back together.
#
# @param initial_args [Array<String>]
# @param options [Hash]
# @option options [Array<String>] :args long list of arguments to split up
# @return [Overcommit::Subprocess::Result] status, stdout, and stderr
def execute(initial_args, options = {})
if initial_args.include?('|')
raise Overcommit::Exceptions::InvalidCommandArgs,
'Cannot pipe commands with the `execute` helper'
end
result =
if (splittable_args = options.fetch(:args) { [] }).any?
debug(initial_args.join(' ') + " ... (#{splittable_args.length} splittable args)")
Overcommit::CommandSplitter.execute(initial_args, options)
else
debug(initial_args.join(' '))
Overcommit::Subprocess.spawn(initial_args, options)
end
debug("EXIT STATUS: #{result.status}")
debug("STDOUT: #{result.stdout.inspect}")
debug("STDERR: #{result.stderr.inspect}")
result
endView on GitHub (pinned to fee0cd74b2)
Solutions
- Remove the pipe (`|`) from the command array passed to `execute`; run each stage of the pipeline as a separate `execute` call and chain the output yourself.
- If shell piping is truly required, wrap the command in an explicit shell invocation (e.g. `sh -c 'cmd1 | cmd2'`), understanding the security implications.
When it happens
Trigger: Thrown at lib/overcommit/utils.rb:206 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/4a91501160c9abfb.
Report an issue: GitHub.