diff --git a/src/flake8/options/config.py b/src/flake8/options/config.py
index f5c93ce..36fe976 100644
--- a/src/flake8/options/config.py
+++ b/src/flake8/options/config.py
@@ -23,7 +23,10 @@ def _stat_key(s: str) -> Tuple[int, int]:
 def _find_config_file(path: str) -> Optional[str]:
     # on windows if the homedir isn't detected this returns back `~`
     home = os.path.expanduser("~")
-    home_stat = _stat_key(home) if home != "~" else None
+    try:
+        home_stat = _stat_key(home) if home != "~" else None
+    except OSError:  # FileNotFoundError / PermissionError / etc.
+        home_stat = None
 
     dir_stat = _stat_key(path)
     cfg = configparser.RawConfigParser()

diff --git a/tests/unit/test_options_config.py b/tests/unit/test_options_config.py
index 7a7c4f7..bdc2208 100644
--- a/tests/unit/test_options_config.py
+++ b/tests/unit/test_options_config.py
@@ -78,6 +78,13 @@ def test_find_config_ignores_homedir(tmp_path):
         assert config._find_config_file(str(subdir)) is None
 
 
+def test_find_config_ignores_unknown_homedir(tmp_path):
+    subdir = tmp_path.joinpath("d")
+
+    with mock.patch.object(os.path, "expanduser", return_value=str(subdir)):
+        assert config._find_config_file(str(tmp_path)) is None
+
+
 def test_load_config_config_specified_skips_discovery(tmpdir):
     tmpdir.join("setup.cfg").write("[flake8]\nindent-size=2\n")
     custom_cfg = tmpdir.join("custom.cfg")

Exception if HOME is not an existing path
### how did you install flake8?

```console
$ pip install flake8
```


### unmodified output of `flake8 --bug-report`

```json
{
  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.9.13",
    "system": "Linux"
  },
  "plugins": [
    {
      "plugin": "mccabe",
      "version": "0.7.0"
    },
    {
      "plugin": "pycodestyle",
      "version": "2.9.0"
    },
    {
      "plugin": "pyflakes",
      "version": "2.5.0"
    }
  ],
  "version": "5.0.1"
}
```


### describe the problem

#### what I expected to happen

flake8 should not raise an exception if $HOME points to an invalid directory

For example, when running as the `nobody` user in a Debian-based Docker image, and $HOME points to `/nonexistent`.

#### commands ran

```console
# sudo -u nobody flake8
Traceback (most recent call last):
  File "/usr/local/bin/flake8", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.9/site-packages/flake8/main/cli.py", line 22, in main
    app.run(argv)
  File "/usr/local/lib/python3.9/site-packages/flake8/main/application.py", line 336, in run
    self._run(argv)
  File "/usr/local/lib/python3.9/site-packages/flake8/main/application.py", line 324, in _run
    self.initialize(argv)
  File "/usr/local/lib/python3.9/site-packages/flake8/main/application.py", line 296, in initialize
    cfg, cfg_dir = config.load_config(
  File "/usr/local/lib/python3.9/site-packages/flake8/options/config.py", line 73, in load_config
    config = _find_config_file(pwd)
  File "/usr/local/lib/python3.9/site-packages/flake8/options/config.py", line 26, in _find_config_file
    home_stat = _stat_key(home) if home != "~" else None
  File "/usr/local/lib/python3.9/site-packages/flake8/options/config.py", line 19, in _stat_key
    st = os.stat(s)
FileNotFoundError: [Errno 2] No such file or directory: '/nonexistent'
```

tests/unit/test_options_config.py::test_find_config_ignores_unknown_homedir
tests/unit/test_options_config.py::test_config_not_found_returns_none tests/unit/test_options_config.py::test_config_file_without_section_is_not_considered tests/unit/test_options_config.py::test_config_file_with_parse_error_is_not_considered tests/unit/test_options_config.py::test_config_file_with_encoding_error_is_not_considered tests/unit/test_options_config.py::test_find_config_file_exists_at_path[setup.cfg] tests/unit/test_options_config.py::test_find_config_file_exists_at_path[tox.ini] tests/unit/test_options_config.py::test_find_config_file_exists_at_path[.flake8] tests/unit/test_options_config.py::test_find_config_either_section[flake8] tests/unit/test_options_config.py::test_find_config_either_section[flake8:local-plugins] tests/unit/test_options_config.py::test_find_config_searches_upwards tests/unit/test_options_config.py::test_find_config_ignores_homedir tests/unit/test_options_config.py::test_load_config_config_specified_skips_discovery tests/unit/test_options_config.py::test_load_config_no_config_file_does_discovery tests/unit/test_options_config.py::test_load_config_no_config_found_sets_cfg_dir_to_pwd tests/unit/test_options_config.py::test_load_config_isolated_ignores_configuration tests/unit/test_options_config.py::test_load_config_append_config tests/unit/test_options_config.py::test_load_auto_config_utf8 tests/unit/test_options_config.py::test_load_explicit_config_utf8 tests/unit/test_options_config.py::test_load_extra_config_utf8 tests/unit/test_options_config.py::test_parse_config_no_values tests/unit/test_options_config.py::test_parse_config_typed_values tests/unit/test_options_config.py::test_parse_config_ignores_unknowns tests/unit/test_options_config.py::test_load_config_missing_file_raises_exception