{"record":{"id":"eb351c41503fb8d8","repo":"sds/overcommit","slug":"one-or-more-hooks-had-an-invalid-env-configurati","errorCode":null,"errorMessage":"One or more hooks had an invalid `env` configuration option","messagePattern":"One or more hooks had an invalid `env` configuration option","errorType":"exception","errorClass":"Overcommit::Exceptions::ConfigurationError","httpStatus":null,"severity":"error","filePath":"lib/overcommit/configuration_validator.rb","lineNumber":91,"sourceCode":"              errors << \"#{hook_type}::#{hook_name} has an invalid `env` specified: \" \\\n                        \"variable name `#{var_name}` cannot contain `=`.\"\n            end\n\n            unless var_value.nil? || var_value.is_a?(String)\n              errors << \"#{hook_type}::#{hook_name} has an invalid `env` specified: \" \\\n                        \"value of `#{var_name}` must be a string or `nil`, but was \" \\\n                        \"#{var_value.inspect} (#{var_value.class})\"\n            end\n          end\n        end\n      end\n\n      if errors.any?\n        if @log\n          @log.error errors.join(\"\\n\")\n          @log.newline\n        end\n        raise Overcommit::Exceptions::ConfigurationError,\n              'One or more hooks had an invalid `env` configuration option'\n      end\n    end\n\n    # Prints an error message and raises an exception if a hook has an\n    # invalid name, since this can result in strange errors elsewhere.\n    def check_hook_name_format(hash)\n      errors = []\n\n      Overcommit::Utils.supported_hook_type_classes.each do |hook_type|\n        hash.fetch(hook_type) { {} }.each_key do |hook_name|\n          next if hook_name == 'ALL'\n\n          unless hook_name.match?(/\\A[A-Za-z0-9]+\\z/)\n            errors << \"#{hook_type}::#{hook_name} has an invalid name \" \\\n                      \"#{hook_name}. It must contain only alphanumeric \" \\\n                      'characters (no underscores or dashes, etc.)'\n          end","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/sds/overcommit/blob/fee0cd74b26eb81f64b43b7fab17bbb541575cc4/lib/overcommit/configuration_validator.rb#L73-L109","documentation":"Error \"One or more hooks had an invalid `env` configuration option\" thrown in sds/overcommit.","triggerScenarios":"Thrown at lib/overcommit/configuration_validator.rb:91 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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."],"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"}