diff --git a/pre_commit/error_handler.py b/pre_commit/error_handler.py
index 946f134..5b09a01 100644
--- a/pre_commit/error_handler.py
+++ b/pre_commit/error_handler.py
@@ -4,10 +4,12 @@ from __future__ import unicode_literals
 
 import contextlib
 import os.path
+import sys
 import traceback
 
 import six
 
+import pre_commit.constants as C
 from pre_commit import five
 from pre_commit import output
 from pre_commit.store import Store
@@ -34,9 +36,36 @@ def _log_and_exit(msg, exc, formatted):
     store = Store()
     log_path = os.path.join(store.directory, 'pre-commit.log')
     output.write_line('Check the log at {}'.format(log_path))
+
     with open(log_path, 'wb') as log:
+        output.write_line(
+            '### version information\n```', stream=log,
+        )
+        output.write_line(
+            'pre-commit.version: {}'.format(C.VERSION), stream=log,
+        )
+        output.write_line(
+            'sys.version:\n{}'.format(
+                '\n'.join(
+                    [
+                        '    {}'.format(line)
+                        for line in sys.version.splitlines()
+                    ],
+                ),
+            ),
+            stream=log,
+        )
+        output.write_line(
+            'sys.executable: {}'.format(sys.executable), stream=log,
+        )
+        output.write_line('os.name: {}'.format(os.name), stream=log)
+        output.write_line(
+            'sys.platform: {}\n```'.format(sys.platform), stream=log,
+        )
+        output.write_line('### error information\n```', stream=log)
         output.write(error_msg, stream=log)
         output.write_line(formatted, stream=log)
+        output.write('\n```\n', stream=log)
     raise SystemExit(1)
 
 
diff --git a/requirements-dev.txt b/requirements-dev.txt
index ba80df7..157f287 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -1,6 +1,7 @@
 -e .
 
 coverage
+flake8
 mock
 pytest
 pytest-env

include version information in error log
would be useful to include things like:

- pre-commit version
- sys.version
- sys.executable
diff --git a/tests/commands/run_test.py b/tests/commands/run_test.py
index 49ce008..94d44e1 100644
--- a/tests/commands/run_test.py
+++ b/tests/commands/run_test.py
@@ -3,7 +3,6 @@ from __future__ import unicode_literals
 
 import io
 import os.path
-import pipes
 import subprocess
 import sys
 
@@ -643,11 +642,9 @@ def test_local_hook_passes(cap_out, store, repo_with_passing_hook):
         'repo': 'local',
         'hooks': [
             {
-                'id': 'identity-copy',
-                'name': 'identity-copy',
-                'entry': '{} -m pre_commit.meta_hooks.identity'.format(
-                    pipes.quote(sys.executable),
-                ),
+                'id': 'flake8',
+                'name': 'flake8',
+                'entry': "'{}' -m flake8".format(sys.executable),
                 'language': 'system',
                 'files': r'\.py$',
             },
@@ -872,13 +869,10 @@ def test_args_hook_only(cap_out, store, repo_with_passing_hook):
         'repo': 'local',
         'hooks': [
             {
-                'id': 'identity-copy',
-                'name': 'identity-copy',
-                'entry': '{} -m pre_commit.meta_hooks.identity'.format(
-                    pipes.quote(sys.executable),
-                ),
+                'id': 'flake8',
+                'name': 'flake8',
+                'entry': "'{}' -m flake8".format(sys.executable),
                 'language': 'system',
-                'files': r'\.py$',
                 'stages': ['commit'],
             },
             {
@@ -897,4 +891,4 @@ def test_args_hook_only(cap_out, store, repo_with_passing_hook):
         repo_with_passing_hook,
         run_opts(hook='do_not_commit'),
     )
-    assert b'identity-copy' not in printed
+    assert b'flake8' not in printed
diff --git a/tests/error_handler_test.py b/tests/error_handler_test.py
index 1b222f9..e94b320 100644
--- a/tests/error_handler_test.py
+++ b/tests/error_handler_test.py
@@ -105,16 +105,29 @@ def test_log_and_exit(cap_out, mock_store_dir):
     printed = cap_out.get()
     log_file = os.path.join(mock_store_dir, 'pre-commit.log')
     assert printed == (
-        'msg: FatalError: hai\n'
-        'Check the log at {}\n'.format(log_file)
+        'msg: FatalError: hai\n' 'Check the log at {}\n'.format(log_file)
     )
 
     assert os.path.exists(log_file)
     with io.open(log_file) as f:
-        assert f.read() == (
-            'msg: FatalError: hai\n'
-            "I'm a stacktrace\n"
+        logged = f.read()
+        expected = (
+            r'^### version information\n'
+            r'```\n'
+            r'pre-commit.version: \d+\.\d+\.\d+\n'
+            r'sys.version:\n(    .*\n)*'
+            r'sys.executable: .*\n'
+            r'os.name: .*\n'
+            r'sys.platform: .*\n'
+            r'```\n'
+            r'### error information\n'
+            r'```\n'
+            r'msg: FatalError: hai\n'
+            r"I'm a stacktrace\n"
+            r'\n'
+            r'```\n'
         )
+        assert re.match(expected, logged)
 
 
 def test_error_handler_non_ascii_exception(mock_store_dir):
@@ -126,7 +139,8 @@ def test_error_handler_non_ascii_exception(mock_store_dir):
 def test_error_handler_no_tty(tempdir_factory):
     pre_commit_home = tempdir_factory.get()
     output = cmd_output_mocked_pre_commit_home(
-        sys.executable, '-c',
+        sys.executable,
+        '-c',
         'from __future__ import unicode_literals\n'
         'from pre_commit.error_handler import error_handler\n'
         'with error_handler():\n'
@@ -136,7 +150,8 @@ def test_error_handler_no_tty(tempdir_factory):
         pre_commit_home=pre_commit_home,
     )
     log_file = os.path.join(pre_commit_home, 'pre-commit.log')
-    assert output[1].replace('\r', '') == (
-        'An unexpected error has occurred: ValueError: ☃\n'
-        'Check the log at {}\n'.format(log_file)
+    output_lines = output[1].replace('\r', '').splitlines()
+    assert (
+        output_lines[-2] == 'An unexpected error has occurred: ValueError: ☃'
     )
+    assert output_lines[-1] == 'Check the log at {}'.format(log_file)
diff --git a/tests/main_test.py b/tests/main_test.py
index 75fd560..aad9c4b 100644
--- a/tests/main_test.py
+++ b/tests/main_test.py
@@ -164,11 +164,13 @@ def test_expected_fatal_error_no_git_repo(in_tmpdir, cap_out, mock_store_dir):
     with pytest.raises(SystemExit):
         main.main([])
     log_file = os.path.join(mock_store_dir, 'pre-commit.log')
-    assert cap_out.get() == (
+    cap_out_lines = cap_out.get().splitlines()
+    assert (
+        cap_out_lines[-2] ==
         'An error has occurred: FatalError: git failed. '
-        'Is it installed, and are you in a Git repository directory?\n'
-        'Check the log at {}\n'.format(log_file)
+        'Is it installed, and are you in a Git repository directory?'
     )
+    assert cap_out_lines[-1] == 'Check the log at {}'.format(log_file)
 
 
 def test_warning_on_tags_only(mock_commands, cap_out, mock_store_dir):

pip install -e .[dev]
parse_log_pytest
requirements.txt
3.9
requirements-dev.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
aspy.yaml==1.3.0
cfgv==3.4.0
coverage==7.8.0
distlib==0.3.9
exceptiongroup==1.2.2
filelock==3.18.0
identify==2.6.9
importlib_metadata==8.6.1
iniconfig==2.1.0
mock==5.2.0
nodeenv==1.9.1
packaging==24.2
platformdirs==4.3.7
pluggy==1.5.0
-e git+https://github.com/pre-commit/pre-commit.git@96c35185f07925ff10a04e3d161c96baf39eaa28#egg=pre_commit
pytest==8.3.5
pytest-env==1.1.5
PyYAML==6.0.2
six==1.17.0
toml==0.10.2
tomli==2.2.1
virtualenv==20.29.3
zipp==3.21.0

name: pre-commit
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - aspy-yaml==1.3.0
      - cfgv==3.4.0
      - coverage==7.8.0
      - distlib==0.3.9
      - exceptiongroup==1.2.2
      - filelock==3.18.0
      - identify==2.6.9
      - importlib-metadata==8.6.1
      - iniconfig==2.1.0
      - mock==5.2.0
      - nodeenv==1.9.1
      - packaging==24.2
      - platformdirs==4.3.7
      - pluggy==1.5.0
      - pytest==8.3.5
      - pytest-env==1.1.5
      - pyyaml==6.0.2
      - six==1.17.0
      - toml==0.10.2
      - tomli==2.2.1
      - virtualenv==20.29.3
      - zipp==3.21.0
prefix: /opt/conda/envs/pre-commit

tests/error_handler_test.py::test_log_and_exit
tests/commands/run_test.py::test_local_hook_passes
tests/commands/run_test.py::test_run[options3-outputs3-1-True] tests/commands/run_test.py::test_run[options4-outputs4-1-True] tests/commands/run_test.py::test_run[options7-outputs7-0-False] tests/commands/run_test.py::test_origin_source_error_msg_error[master-] tests/commands/run_test.py::test_origin_source_error_msg_error[-master] tests/commands/run_test.py::test_origin_source_both_ok tests/commands/run_test.py::test_has_unmerged_paths tests/commands/run_test.py::test_merge_conflict tests/commands/run_test.py::test_merge_conflict_modified tests/commands/run_test.py::test_compute_cols[hooks0-True-80] tests/commands/run_test.py::test_compute_cols[hooks1-False-81] tests/commands/run_test.py::test_compute_cols[hooks2-True-85] tests/commands/run_test.py::test_compute_cols[hooks3-False-82] tests/commands/run_test.py::test_get_skips[environ0-expected_output0] tests/commands/run_test.py::test_get_skips[environ1-expected_output1] tests/commands/run_test.py::test_get_skips[environ2-expected_output2] tests/commands/run_test.py::test_get_skips[environ3-expected_output3] tests/commands/run_test.py::test_get_skips[environ4-expected_output4] tests/commands/run_test.py::test_get_skips[environ5-expected_output5] tests/commands/run_test.py::test_get_skips[environ6-expected_output6] tests/commands/run_test.py::test_skip_hook tests/commands/run_test.py::test_skip_aliased_hook tests/commands/run_test.py::test_hook_id_not_in_non_verbose_output tests/commands/run_test.py::test_hook_id_in_verbose_output tests/commands/run_test.py::test_non_ascii_hook_id tests/commands/run_test.py::test_stdout_write_bug_py26 tests/commands/run_test.py::test_lots_of_files tests/commands/run_test.py::test_stages tests/commands/run_test.py::test_pcre_deprecation_warning tests/commands/run_test.py::test_meta_hook_passes tests/commands/run_test.py::test_error_with_unstaged_config tests/commands/run_test.py::test_files_running_subdir tests/commands/run_test.py::test_classifier_removes_dne tests/commands/run_test.py::test_include_exclude_base_case tests/commands/run_test.py::test_matches_broken_symlink tests/commands/run_test.py::test_include_exclude_total_match tests/commands/run_test.py::test_include_exclude_does_search_instead_of_match tests/commands/run_test.py::test_include_exclude_exclude_removes_files tests/commands/run_test.py::test_args_hook_only tests/error_handler_test.py::test_error_handler_no_exception tests/error_handler_test.py::test_error_handler_fatal_error tests/error_handler_test.py::test_error_handler_uncaught_error tests/error_handler_test.py::test_error_handler_keyboardinterrupt tests/error_handler_test.py::test_error_handler_non_ascii_exception tests/error_handler_test.py::test_error_handler_no_tty tests/main_test.py::test_adjust_args_and_chdir_not_in_git_dir tests/main_test.py::test_adjust_args_and_chdir_noop tests/main_test.py::test_adjust_args_and_chdir_relative_things tests/main_test.py::test_adjust_args_and_chdir_non_relative_config tests/main_test.py::test_adjust_args_try_repo_repo_relative tests/main_test.py::test_overall_help tests/main_test.py::test_help_command tests/main_test.py::test_help_other_command tests/main_test.py::test_all_cmds[autoupdate] tests/main_test.py::test_all_cmds[clean] tests/main_test.py::test_all_cmds[gc] tests/main_test.py::test_all_cmds[install] tests/main_test.py::test_all_cmds[install-hooks] tests/main_test.py::test_all_cmds[migrate-config] tests/main_test.py::test_all_cmds[run] tests/main_test.py::test_all_cmds[sample-config] tests/main_test.py::test_all_cmds[uninstall] tests/main_test.py::test_try_repo tests/main_test.py::test_init_templatedir tests/main_test.py::test_help_cmd_in_empty_directory tests/main_test.py::test_expected_fatal_error_no_git_repo tests/main_test.py::test_warning_on_tags_only
requirements-dev.txt pre_commit/error_handler.py
requirements-dev.txt pre_commit/error_handler.py