sds/overcommit · error · Overcommit::Exceptions::ConfigurationError
One or more hooks had an invalid `env` configuration option
Error message
One or more hooks had an invalid `env` configuration option
What it means
Error "One or more hooks had an invalid `env` configuration option" thrown in sds/overcommit.
Source
Thrown at lib/overcommit/configuration_validator.rb:91
errors << "#{hook_type}::#{hook_name} has an invalid `env` specified: " \
"variable name `#{var_name}` cannot contain `=`."
end
unless var_value.nil? || var_value.is_a?(String)
errors << "#{hook_type}::#{hook_name} has an invalid `env` specified: " \
"value of `#{var_name}` must be a string or `nil`, but was " \
"#{var_value.inspect} (#{var_value.class})"
end
end
end
end
if errors.any?
if @log
@log.error errors.join("\n")
@log.newline
end
raise Overcommit::Exceptions::ConfigurationError,
'One or more hooks had an invalid `env` configuration option'
end
end
# Prints an error message and raises an exception if a hook has an
# invalid name, since this can result in strange errors elsewhere.
def check_hook_name_format(hash)
errors = []
Overcommit::Utils.supported_hook_type_classes.each do |hook_type|
hash.fetch(hook_type) { {} }.each_key do |hook_name|
next if hook_name == 'ALL'
unless hook_name.match?(/\A[A-Za-z0-9]+\z/)
errors << "#{hook_type}::#{hook_name} has an invalid name " \
"#{hook_name}. It must contain only alphanumeric " \
'characters (no underscores or dashes, etc.)'
endView on GitHub (pinned to fee0cd74b2)
Solutions
- Fix each hook's `env` option in .overcommit.yml: it must be a hash mapping environment variable names to string (or nil) values.
- Remove `=` characters from variable names and convert non-string values (numbers, arrays) to strings, then rerun overcommit.
- Check the error lines printed above the message; they name the hook and the exact `env` problem.
When it happens
Trigger: Thrown at lib/overcommit/configuration_validator.rb:91 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/eb351c41503fb8d8.
Report an issue: GitHub.